]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/Frontend/PrintParserCallbacks.cpp
Import Clang, at r72805.
[FreeBSD/FreeBSD.git] / lib / Frontend / PrintParserCallbacks.cpp
1 //===--- PrintParserActions.cpp - Implement -parse-print-callbacks mode ---===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This code simply runs the preprocessor on the input file and prints out the
11 // result.  This is the traditional behavior of the -E option.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #include "clang/Frontend/Utils.h"
16 #include "clang/Parse/Action.h"
17 #include "clang/Parse/DeclSpec.h"
18 #include "llvm/Support/raw_ostream.h"
19 using namespace clang;
20
21 namespace {
22   class ParserPrintActions : public MinimalAction {
23   llvm::raw_ostream& Out;
24
25   public:
26     ParserPrintActions(Preprocessor &PP, llvm::raw_ostream& OS)
27       : MinimalAction(PP), Out(OS) {}
28
29     // Printing Functions which also must call MinimalAction
30
31     /// ActOnDeclarator - This callback is invoked when a declarator is parsed
32     /// and 'Init' specifies the initializer if any.  This is for things like:
33     /// "int X = 4" or "typedef int foo".
34     virtual DeclPtrTy ActOnDeclarator(Scope *S, Declarator &D) {
35       Out << __FUNCTION__ << " ";
36       if (IdentifierInfo *II = D.getIdentifier()) {
37         Out << "'" << II->getName() << "'";
38       } else {
39         Out << "<anon>";
40       }
41       Out << "\n";
42       
43       // Pass up to EmptyActions so that the symbol table is maintained right.
44       return MinimalAction::ActOnDeclarator(S, D);
45     }
46     /// ActOnPopScope - This callback is called immediately before the specified
47     /// scope is popped and deleted.
48     virtual void ActOnPopScope(SourceLocation Loc, Scope *S) {
49       Out << __FUNCTION__ << "\n";
50       return MinimalAction::ActOnPopScope(Loc, S);
51     }
52
53     /// ActOnTranslationUnitScope - This callback is called once, immediately
54     /// after creating the translation unit scope (in Parser::Initialize).
55     virtual void ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {
56       Out << __FUNCTION__ << "\n";
57       MinimalAction::ActOnTranslationUnitScope(Loc, S);
58     }
59
60
61     Action::DeclPtrTy ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
62                                                IdentifierInfo *ClassName,
63                                                SourceLocation ClassLoc,
64                                                IdentifierInfo *SuperName,
65                                                SourceLocation SuperLoc,
66                                                const DeclPtrTy *ProtoRefs,
67                                                unsigned NumProtocols,
68                                                SourceLocation EndProtoLoc,
69                                                AttributeList *AttrList) {
70       Out << __FUNCTION__ << "\n";
71       return MinimalAction::ActOnStartClassInterface(AtInterfaceLoc,
72                                                      ClassName, ClassLoc, 
73                                                      SuperName, SuperLoc,
74                                                      ProtoRefs, NumProtocols,
75                                                      EndProtoLoc, AttrList);
76     }
77
78     /// ActOnForwardClassDeclaration - 
79     /// Scope will always be top level file scope. 
80     Action::DeclPtrTy ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
81                                                    IdentifierInfo **IdentList, 
82                                                    unsigned NumElts) {
83       Out << __FUNCTION__ << "\n";
84       return MinimalAction::ActOnForwardClassDeclaration(AtClassLoc, IdentList,
85                                                          NumElts);
86     }
87
88     // Pure Printing
89
90     /// ActOnParamDeclarator - This callback is invoked when a parameter
91     /// declarator is parsed. This callback only occurs for functions
92     /// with prototypes. S is the function prototype scope for the
93     /// parameters (C++ [basic.scope.proto]).
94     virtual DeclPtrTy ActOnParamDeclarator(Scope *S, Declarator &D) {
95       Out << __FUNCTION__ << " ";
96       if (IdentifierInfo *II = D.getIdentifier()) {
97         Out << "'" << II->getName() << "'";
98       } else {
99         Out << "<anon>";
100       }
101       Out << "\n";
102       return DeclPtrTy();
103     }
104     
105     /// AddInitializerToDecl - This action is called immediately after 
106     /// ParseDeclarator (when an initializer is present). The code is factored 
107     /// this way to make sure we are able to handle the following:
108     ///   void func() { int xx = xx; }
109     /// This allows ActOnDeclarator to register "xx" prior to parsing the
110     /// initializer. The declaration above should still result in a warning, 
111     /// since the reference to "xx" is uninitialized.
112     virtual void AddInitializerToDecl(DeclPtrTy Dcl, FullExprArg Init) {
113       Out << __FUNCTION__ << "\n";
114     }
115
116     /// FinalizeDeclaratorGroup - After a sequence of declarators are parsed,
117     /// this gives the actions implementation a chance to process the group as
118     /// a whole.
119     virtual DeclGroupPtrTy FinalizeDeclaratorGroup(Scope *S, const DeclSpec& DS,
120                                                    DeclPtrTy *Group,
121                                                    unsigned NumDecls) {
122       Out << __FUNCTION__ << "\n";
123       return DeclGroupPtrTy();
124     }
125
126     /// ActOnStartOfFunctionDef - This is called at the start of a function
127     /// definition, instead of calling ActOnDeclarator.  The Declarator includes
128     /// information about formal arguments that are part of this function.
129     virtual DeclPtrTy ActOnStartOfFunctionDef(Scope *FnBodyScope,
130                                               Declarator &D){
131       Out << __FUNCTION__ << "\n";
132       return DeclPtrTy();
133     }
134
135     /// ActOnStartOfFunctionDef - This is called at the start of a function
136     /// definition, after the FunctionDecl has already been created.
137     virtual DeclPtrTy ActOnStartOfFunctionDef(Scope *FnBodyScope, DeclPtrTy D) {
138       Out << __FUNCTION__ << "\n";
139       return DeclPtrTy();
140     }
141
142     virtual void ActOnStartOfObjCMethodDef(Scope *FnBodyScope, DeclPtrTy D) {
143       Out << __FUNCTION__ << "\n";
144     }
145   
146     /// ActOnFunctionDefBody - This is called when a function body has completed
147     /// parsing.  Decl is the DeclTy returned by ParseStartOfFunctionDef.
148     virtual DeclPtrTy ActOnFinishFunctionBody(DeclPtrTy Decl, StmtArg Body) {
149       Out << __FUNCTION__ << "\n";
150       return DeclPtrTy();
151     }
152
153     virtual DeclPtrTy ActOnFileScopeAsmDecl(SourceLocation Loc,
154                                             ExprArg AsmString) {
155       Out << __FUNCTION__ << "\n";
156       return DeclPtrTy();
157     }
158   
159     /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
160     /// no declarator (e.g. "struct foo;") is parsed.
161     virtual DeclPtrTy ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS) {
162       Out << __FUNCTION__ << "\n";
163       return DeclPtrTy();
164     }
165     
166     /// ActOnLinkageSpec - Parsed a C++ linkage-specification that
167     /// contained braces. Lang/StrSize contains the language string that
168     /// was parsed at location Loc. Decls/NumDecls provides the
169     /// declarations parsed inside the linkage specification.
170     virtual DeclPtrTy ActOnLinkageSpec(SourceLocation Loc,
171                                        SourceLocation LBrace,
172                                        SourceLocation RBrace, const char *Lang,
173                                        unsigned StrSize, 
174                                        DeclPtrTy *Decls, unsigned NumDecls) {
175       Out << __FUNCTION__ << "\n";
176       return DeclPtrTy();
177     }
178     
179     /// ActOnLinkageSpec - Parsed a C++ linkage-specification without
180     /// braces. Lang/StrSize contains the language string that was
181     /// parsed at location Loc. D is the declaration parsed.
182     virtual DeclPtrTy ActOnLinkageSpec(SourceLocation Loc, const char *Lang,
183                                        unsigned StrSize, DeclPtrTy D) {
184       return DeclPtrTy();
185     }
186     
187     //===------------------------------------------------------------------===//
188     // Type Parsing Callbacks.
189     //===------------------------------------------------------------------===//
190   
191     virtual TypeResult ActOnTypeName(Scope *S, Declarator &D) {
192       Out << __FUNCTION__ << "\n";
193       return TypeResult();
194     }
195   
196     virtual DeclPtrTy ActOnTag(Scope *S, unsigned TagType, TagKind TK,
197                                SourceLocation KWLoc, const CXXScopeSpec &SS,
198                                IdentifierInfo *Name, SourceLocation NameLoc,
199                                AttributeList *Attr, AccessSpecifier AS,
200                                bool &Owned) {
201       // TagType is an instance of DeclSpec::TST, indicating what kind of tag this
202       // is (struct/union/enum/class).
203       Out << __FUNCTION__ << "\n";
204       return DeclPtrTy();
205     }
206   
207     /// Act on @defs() element found when parsing a structure.  ClassName is the
208     /// name of the referenced class.   
209     virtual void ActOnDefs(Scope *S, DeclPtrTy TagD, SourceLocation DeclStart,
210                            IdentifierInfo *ClassName,
211                            llvm::SmallVectorImpl<DeclPtrTy> &Decls) {
212       Out << __FUNCTION__ << "\n";
213     }
214
215     virtual DeclPtrTy ActOnField(Scope *S, DeclPtrTy TagD, 
216                                  SourceLocation DeclStart,
217                                  Declarator &D, ExprTy *BitfieldWidth) {
218       Out << __FUNCTION__ << "\n";
219       return DeclPtrTy();
220     }
221   
222     virtual DeclPtrTy ActOnIvar(Scope *S, SourceLocation DeclStart,
223                                 Declarator &D, ExprTy *BitfieldWidth,
224                                 tok::ObjCKeywordKind visibility) {
225       Out << __FUNCTION__ << "\n";
226       return DeclPtrTy();
227     }
228   
229     virtual void ActOnFields(Scope* S, SourceLocation RecLoc, DeclPtrTy TagDecl,
230                              DeclPtrTy *Fields, unsigned NumFields, 
231                              SourceLocation LBrac, SourceLocation RBrac,
232                              AttributeList *AttrList) {
233       Out << __FUNCTION__ << "\n";
234     }
235   
236     virtual DeclPtrTy ActOnEnumConstant(Scope *S, DeclPtrTy EnumDecl,
237                                         DeclPtrTy LastEnumConstant,
238                                         SourceLocation IdLoc,IdentifierInfo *Id,
239                                         SourceLocation EqualLoc, ExprTy *Val) {
240       Out << __FUNCTION__ << "\n";
241       return DeclPtrTy();
242     }
243
244     virtual void ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
245                                SourceLocation RBraceLoc, DeclPtrTy EnumDecl,
246                                DeclPtrTy *Elements, unsigned NumElements) {
247       Out << __FUNCTION__ << "\n";
248     }
249
250     //===------------------------------------------------------------------===//
251     // Statement Parsing Callbacks.
252     //===------------------------------------------------------------------===//
253
254     virtual OwningStmtResult ActOnNullStmt(SourceLocation SemiLoc) {
255       Out << __FUNCTION__ << "\n";
256       return StmtEmpty();
257     }
258
259     virtual OwningStmtResult ActOnCompoundStmt(SourceLocation L,
260                                                SourceLocation R,
261                                                MultiStmtArg Elts,
262                                                bool isStmtExpr) {
263       Out << __FUNCTION__ << "\n";
264       return StmtEmpty();
265     }
266     virtual OwningStmtResult ActOnDeclStmt(DeclGroupPtrTy Decl,
267                                            SourceLocation StartLoc,
268                                            SourceLocation EndLoc) {
269       Out << __FUNCTION__ << "\n";
270       return StmtEmpty();
271     }
272   
273     virtual OwningStmtResult ActOnExprStmt(FullExprArg Expr) {
274       Out << __FUNCTION__ << "\n";
275       return OwningStmtResult(*this, Expr->release());
276     }
277   
278     /// ActOnCaseStmt - Note that this handles the GNU 'case 1 ... 4' extension,
279     /// which can specify an RHS value.
280     virtual OwningStmtResult ActOnCaseStmt(SourceLocation CaseLoc,
281                                            ExprArg LHSVal,
282                                            SourceLocation DotDotDotLoc,
283                                            ExprArg RHSVal,
284                                            SourceLocation ColonLoc) {
285       Out << __FUNCTION__ << "\n";
286       return StmtEmpty();
287     }
288     virtual OwningStmtResult ActOnDefaultStmt(SourceLocation DefaultLoc,
289                                               SourceLocation ColonLoc,
290                                               StmtArg SubStmt, Scope *CurScope){
291       Out << __FUNCTION__ << "\n";
292       return StmtEmpty();
293     }
294
295     virtual OwningStmtResult ActOnLabelStmt(SourceLocation IdentLoc,
296                                             IdentifierInfo *II,
297                                             SourceLocation ColonLoc,
298                                             StmtArg SubStmt) {
299       Out << __FUNCTION__ << "\n";
300       return StmtEmpty();
301     }
302
303     virtual OwningStmtResult ActOnIfStmt(SourceLocation IfLoc, 
304                                          FullExprArg CondVal, StmtArg ThenVal,
305                                          SourceLocation ElseLoc,
306                                          StmtArg ElseVal) {
307       Out << __FUNCTION__ << "\n";
308       return StmtEmpty();
309     }
310
311     virtual OwningStmtResult ActOnStartOfSwitchStmt(ExprArg Cond) {
312       Out << __FUNCTION__ << "\n";
313       return StmtEmpty();
314     }
315
316     virtual OwningStmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc,
317                                                    StmtArg Switch,
318                                                    StmtArg Body) {
319       Out << __FUNCTION__ << "\n";
320       return StmtEmpty();
321     }
322
323     virtual OwningStmtResult ActOnWhileStmt(SourceLocation WhileLoc,
324                                             FullExprArg Cond, StmtArg Body) {
325       Out << __FUNCTION__ << "\n";
326       return StmtEmpty();
327     }
328     virtual OwningStmtResult ActOnDoStmt(SourceLocation DoLoc, StmtArg Body,
329                                          SourceLocation WhileLoc, ExprArg Cond){
330       Out << __FUNCTION__ << "\n";
331       return StmtEmpty();
332     }
333     virtual OwningStmtResult ActOnForStmt(SourceLocation ForLoc,
334                                         SourceLocation LParenLoc,
335                                         StmtArg First, ExprArg Second,
336                                         ExprArg Third, SourceLocation RParenLoc,
337                                         StmtArg Body) {
338       Out << __FUNCTION__ << "\n";
339       return StmtEmpty();
340     }
341     virtual OwningStmtResult ActOnObjCForCollectionStmt(
342                                        SourceLocation ForColLoc,
343                                        SourceLocation LParenLoc,
344                                        StmtArg First, ExprArg Second,
345                                        SourceLocation RParenLoc, StmtArg Body) {
346       Out << __FUNCTION__ << "\n";
347       return StmtEmpty();
348     }
349     virtual OwningStmtResult ActOnGotoStmt(SourceLocation GotoLoc,
350                                            SourceLocation LabelLoc,
351                                            IdentifierInfo *LabelII) {
352       Out << __FUNCTION__ << "\n";
353       return StmtEmpty();
354     }
355     virtual OwningStmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc,
356                                                    SourceLocation StarLoc,
357                                                    ExprArg DestExp) {
358       Out << __FUNCTION__ << "\n";
359       return StmtEmpty();
360     }
361     virtual OwningStmtResult ActOnContinueStmt(SourceLocation ContinueLoc,
362                                                Scope *CurScope) {
363       Out << __FUNCTION__ << "\n";
364       return StmtEmpty();
365     }
366     virtual OwningStmtResult ActOnBreakStmt(SourceLocation GotoLoc,
367                                             Scope *CurScope) {
368       Out << __FUNCTION__ << "\n";
369       return StmtEmpty();
370     }
371     virtual OwningStmtResult ActOnReturnStmt(SourceLocation ReturnLoc,
372                                              FullExprArg RetValExp) {
373       Out << __FUNCTION__ << "\n";
374       return StmtEmpty();
375     }
376     virtual OwningStmtResult ActOnAsmStmt(SourceLocation AsmLoc,
377                                           bool IsSimple,
378                                           bool IsVolatile,
379                                           unsigned NumOutputs,
380                                           unsigned NumInputs,
381                                           std::string *Names,
382                                           MultiExprArg Constraints,
383                                           MultiExprArg Exprs,
384                                           ExprArg AsmString,
385                                           MultiExprArg Clobbers,
386                                           SourceLocation RParenLoc) {
387       Out << __FUNCTION__ << "\n";
388       return StmtEmpty();
389     }
390
391     // Objective-c statements
392     virtual OwningStmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc,
393                                                   SourceLocation RParen,
394                                                   DeclPtrTy Parm, StmtArg Body,
395                                                   StmtArg CatchList) {
396       Out << __FUNCTION__ << "\n";
397       return StmtEmpty();
398     }
399
400     virtual OwningStmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc,
401                                                     StmtArg Body) {
402       Out << __FUNCTION__ << "\n";
403       return StmtEmpty();
404     }
405
406     virtual OwningStmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc,
407                                                 StmtArg Try, StmtArg Catch,
408                                                 StmtArg Finally) {
409       Out << __FUNCTION__ << "\n";
410       return StmtEmpty();
411     }
412
413     virtual OwningStmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc,
414                                                   ExprArg Throw,
415                                                   Scope *CurScope) {
416       Out << __FUNCTION__ << "\n";
417       return StmtEmpty();
418     }
419
420     virtual OwningStmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
421                                                          ExprArg SynchExpr,
422                                                          StmtArg SynchBody) {
423       Out << __FUNCTION__ << "\n";
424       return StmtEmpty();
425     }
426
427     // C++ Statements
428     virtual DeclPtrTy ActOnExceptionDeclarator(Scope *S, Declarator &D) {
429       Out << __FUNCTION__ << "\n";
430       return DeclPtrTy();
431     }
432
433     virtual OwningStmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc,
434                                                 DeclPtrTy ExceptionDecl,
435                                                 StmtArg HandlerBlock) {
436       Out << __FUNCTION__ << "\n";
437       return StmtEmpty();
438     }
439
440     virtual OwningStmtResult ActOnCXXTryBlock(SourceLocation TryLoc,
441                                               StmtArg TryBlock,
442                                               MultiStmtArg Handlers) {
443       Out << __FUNCTION__ << "\n";
444       return StmtEmpty();
445     }
446
447     //===------------------------------------------------------------------===//
448     // Expression Parsing Callbacks.
449     //===------------------------------------------------------------------===//
450
451     // Primary Expressions.
452
453     /// ActOnIdentifierExpr - Parse an identifier in expression context.
454     /// 'HasTrailingLParen' indicates whether or not the identifier has a '('
455     /// token immediately after it.
456     virtual OwningExprResult ActOnIdentifierExpr(Scope *S, SourceLocation Loc,
457                                                  IdentifierInfo &II,
458                                                  bool HasTrailingLParen,
459                                                  const CXXScopeSpec *SS,
460                                                  bool isAddressOfOperand) {
461       Out << __FUNCTION__ << "\n";
462       return ExprEmpty();
463     }
464
465     virtual OwningExprResult ActOnCXXOperatorFunctionIdExpr(
466                                Scope *S, SourceLocation OperatorLoc,
467                                OverloadedOperatorKind Op,
468                                bool HasTrailingLParen, const CXXScopeSpec &SS,
469                                bool isAddressOfOperand) {
470       Out << __FUNCTION__ << "\n";
471       return ExprEmpty();
472     }
473
474     virtual OwningExprResult ActOnCXXConversionFunctionExpr(
475                                Scope *S, SourceLocation OperatorLoc,
476                                TypeTy *Type, bool HasTrailingLParen,
477                                const CXXScopeSpec &SS,bool isAddressOfOperand) {
478       Out << __FUNCTION__ << "\n";
479       return ExprEmpty();
480     }
481
482     virtual OwningExprResult ActOnPredefinedExpr(SourceLocation Loc,
483                                                  tok::TokenKind Kind) {
484       Out << __FUNCTION__ << "\n";
485       return ExprEmpty();
486     }
487
488     virtual OwningExprResult ActOnCharacterConstant(const Token &) { 
489       Out << __FUNCTION__ << "\n";
490       return ExprEmpty();
491     }
492
493     virtual OwningExprResult ActOnNumericConstant(const Token &) { 
494       Out << __FUNCTION__ << "\n";
495       return ExprEmpty();
496     }
497
498     /// ActOnStringLiteral - The specified tokens were lexed as pasted string
499     /// fragments (e.g. "foo" "bar" L"baz").
500     virtual OwningExprResult ActOnStringLiteral(const Token *Toks,
501                                                 unsigned NumToks) {
502       Out << __FUNCTION__ << "\n";
503       return ExprEmpty();
504     }
505
506     virtual OwningExprResult ActOnParenExpr(SourceLocation L, SourceLocation R,
507                                             ExprArg Val) {
508       Out << __FUNCTION__ << "\n";
509       return move(Val);  // Default impl returns operand.
510     }
511
512     // Postfix Expressions.
513     virtual OwningExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc, 
514                                                  tok::TokenKind Kind,
515                                                  ExprArg Input) {
516       Out << __FUNCTION__ << "\n";
517       return ExprEmpty();
518     }
519     virtual OwningExprResult ActOnArraySubscriptExpr(Scope *S, ExprArg Base,
520                                                      SourceLocation LLoc,
521                                                      ExprArg Idx,
522                                                      SourceLocation RLoc) {
523       Out << __FUNCTION__ << "\n";
524       return ExprEmpty();
525     }
526     virtual OwningExprResult ActOnMemberReferenceExpr(Scope *S, ExprArg Base,
527                                                       SourceLocation OpLoc,
528                                                       tok::TokenKind OpKind,
529                                                       SourceLocation MemberLoc,
530                                                       IdentifierInfo &Member,
531                                                       DeclPtrTy ImplDecl) {
532       Out << __FUNCTION__ << "\n";
533       return ExprEmpty();
534     }
535
536     virtual OwningExprResult ActOnCallExpr(Scope *S, ExprArg Fn,
537                                            SourceLocation LParenLoc,
538                                            MultiExprArg Args,
539                                            SourceLocation *CommaLocs,
540                                            SourceLocation RParenLoc) {
541       Out << __FUNCTION__ << "\n";
542       return ExprEmpty();
543     }
544
545     // Unary Operators.  'Tok' is the token for the operator.
546     virtual OwningExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc,
547                                           tok::TokenKind Op, ExprArg Input) {
548       Out << __FUNCTION__ << "\n";
549       return ExprEmpty();
550     }
551     virtual OwningExprResult
552       ActOnSizeOfAlignOfExpr(SourceLocation OpLoc, bool isSizeof, bool isType,
553                              void *TyOrEx, const SourceRange &ArgRange) {
554       Out << __FUNCTION__ << "\n";
555       return ExprEmpty();
556     }
557
558     virtual OwningExprResult ActOnCompoundLiteral(SourceLocation LParen,
559                                                   TypeTy *Ty,
560                                                   SourceLocation RParen,
561                                                   ExprArg Op) {
562       Out << __FUNCTION__ << "\n";
563       return ExprEmpty();
564     }
565     virtual OwningExprResult ActOnInitList(SourceLocation LParenLoc,
566                                            MultiExprArg InitList,
567                                            SourceLocation RParenLoc) {
568       Out << __FUNCTION__ << "\n";
569       return ExprEmpty();
570     }
571     virtual OwningExprResult ActOnCastExpr(SourceLocation LParenLoc, TypeTy *Ty,
572                                            SourceLocation RParenLoc,ExprArg Op){
573       Out << __FUNCTION__ << "\n";
574       return ExprEmpty();
575     }
576
577     virtual OwningExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc,
578                                         tok::TokenKind Kind,
579                                         ExprArg LHS, ExprArg RHS) {
580       Out << __FUNCTION__ << "\n";
581       return ExprEmpty();
582     }
583
584     /// ActOnConditionalOp - Parse a ?: operation.  Note that 'LHS' may be null
585     /// in the case of a the GNU conditional expr extension.
586     virtual OwningExprResult ActOnConditionalOp(SourceLocation QuestionLoc,
587                                                 SourceLocation ColonLoc,
588                                                 ExprArg Cond, ExprArg LHS,
589                                                 ExprArg RHS) {
590       Out << __FUNCTION__ << "\n";
591       return ExprEmpty();
592     }
593
594     //===--------------------- GNU Extension Expressions ------------------===//
595
596     virtual OwningExprResult ActOnAddrLabel(SourceLocation OpLoc,
597                                             SourceLocation LabLoc,
598                                             IdentifierInfo *LabelII) {// "&&foo"
599       Out << __FUNCTION__ << "\n";
600       return ExprEmpty();
601     }
602
603     virtual OwningExprResult ActOnStmtExpr(SourceLocation LPLoc,
604                                            StmtArg SubStmt,
605                                            SourceLocation RPLoc) { // "({..})"
606       Out << __FUNCTION__ << "\n";
607       return ExprEmpty();
608     }
609
610     virtual OwningExprResult ActOnBuiltinOffsetOf(Scope *S,
611                                                   SourceLocation BuiltinLoc,
612                                                   SourceLocation TypeLoc,
613                                                   TypeTy *Arg1,
614                                                   OffsetOfComponent *CompPtr,
615                                                   unsigned NumComponents,
616                                                   SourceLocation RParenLoc) {
617       Out << __FUNCTION__ << "\n";
618       return ExprEmpty();
619     }
620
621     // __builtin_types_compatible_p(type1, type2)
622     virtual OwningExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
623                                                       TypeTy *arg1,TypeTy *arg2,
624                                                       SourceLocation RPLoc) {
625       Out << __FUNCTION__ << "\n";
626       return ExprEmpty();
627     }
628     // __builtin_choose_expr(constExpr, expr1, expr2)
629     virtual OwningExprResult ActOnChooseExpr(SourceLocation BuiltinLoc,
630                                              ExprArg cond, ExprArg expr1,
631                                              ExprArg expr2,
632                                              SourceLocation RPLoc) {
633       Out << __FUNCTION__ << "\n";
634       return ExprEmpty();
635     }
636
637     // __builtin_va_arg(expr, type)
638     virtual OwningExprResult ActOnVAArg(SourceLocation BuiltinLoc,
639                                   ExprArg expr, TypeTy *type,
640                                   SourceLocation RPLoc) {
641       Out << __FUNCTION__ << "\n";
642       return ExprEmpty();
643     }
644
645     virtual OwningExprResult ActOnGNUNullExpr(SourceLocation TokenLoc) {
646       Out << __FUNCTION__ << "\n";
647       return ExprEmpty();
648     }
649
650     virtual void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope) {
651       Out << __FUNCTION__ << "\n";
652     }
653
654     virtual void ActOnBlockArguments(Declarator &ParamInfo, Scope *CurScope) {
655       Out << __FUNCTION__ << "\n";
656     }
657
658     virtual void ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope) {
659       Out << __FUNCTION__ << "\n";
660     }
661
662     virtual OwningExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc,
663                                                 StmtArg Body,
664                                                 Scope *CurScope) {
665       Out << __FUNCTION__ << "\n";
666       return ExprEmpty();
667     }
668
669     virtual DeclPtrTy ActOnStartNamespaceDef(Scope *S, SourceLocation IdentLoc,
670                                              IdentifierInfo *Ident,
671                                              SourceLocation LBrace) {
672       Out << __FUNCTION__ << "\n";
673       return DeclPtrTy();
674     }
675
676     virtual void ActOnFinishNamespaceDef(DeclPtrTy Dcl, SourceLocation RBrace) {
677       Out << __FUNCTION__ << "\n";
678       return;
679     }
680
681 #if 0
682     // FIXME: AttrList should be deleted by this function, but the definition
683     // would have to be available.
684     virtual DeclPtrTy ActOnUsingDirective(Scope *CurScope,
685                                           SourceLocation UsingLoc,
686                                           SourceLocation NamespcLoc,
687                                           const CXXScopeSpec &SS,
688                                           SourceLocation IdentLoc,
689                                           IdentifierInfo *NamespcName,
690                                           AttributeList *AttrList) {
691       Out << __FUNCTION__ << "\n";
692       return DeclPtrTy();
693     }
694 #endif
695
696     virtual void ActOnParamDefaultArgument(DeclPtrTy param,
697                                            SourceLocation EqualLoc,
698                                            ExprArg defarg) {
699       Out << __FUNCTION__ << "\n";
700     }
701
702     virtual void ActOnParamUnparsedDefaultArgument(DeclPtrTy param,
703                                                    SourceLocation EqualLoc) {
704       Out << __FUNCTION__ << "\n";
705     }
706
707     virtual void ActOnParamDefaultArgumentError(DeclPtrTy param) {
708       Out << __FUNCTION__ << "\n";
709     }
710
711     virtual void AddCXXDirectInitializerToDecl(DeclPtrTy Dcl,
712                                                SourceLocation LParenLoc,
713                                                MultiExprArg Exprs,
714                                                SourceLocation *CommaLocs,
715                                                SourceLocation RParenLoc) {
716       Out << __FUNCTION__ << "\n";
717       return;
718     }
719
720     virtual void ActOnStartDelayedCXXMethodDeclaration(Scope *S,
721                                                        DeclPtrTy Method)
722     {
723       Out << __FUNCTION__ << "\n";
724     }
725
726     virtual void ActOnDelayedCXXMethodParameter(Scope *S, DeclPtrTy Param) {
727       Out << __FUNCTION__ << "\n";
728     }
729
730     virtual void ActOnFinishDelayedCXXMethodDeclaration(Scope *S,
731                                                         DeclPtrTy Method) {
732       Out << __FUNCTION__ << "\n";
733     }
734
735     virtual DeclPtrTy ActOnStaticAssertDeclaration(SourceLocation AssertLoc,
736                                                    ExprArg AssertExpr,
737                                                    ExprArg AssertMessageExpr) {
738       Out << __FUNCTION__ << "\n";
739       return DeclPtrTy();
740     }
741
742     virtual OwningExprResult ActOnCXXNamedCast(SourceLocation OpLoc,
743                                                tok::TokenKind Kind,
744                                                SourceLocation LAngleBracketLoc,
745                                                TypeTy *Ty,
746                                                SourceLocation RAngleBracketLoc,
747                                                SourceLocation LParenLoc,
748                                                ExprArg Op,
749                                                SourceLocation RParenLoc) {
750       Out << __FUNCTION__ << "\n";
751       return ExprEmpty();
752     }
753
754     virtual OwningExprResult ActOnCXXTypeid(SourceLocation OpLoc,
755                                             SourceLocation LParenLoc,
756                                             bool isType, void *TyOrExpr,
757                                             SourceLocation RParenLoc) {
758       Out << __FUNCTION__ << "\n";
759       return ExprEmpty();
760     }
761
762     virtual OwningExprResult ActOnCXXThis(SourceLocation ThisLoc) {
763       Out << __FUNCTION__ << "\n";
764       return ExprEmpty();
765     }
766
767     virtual OwningExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc,
768                                                  tok::TokenKind Kind) {
769       Out << __FUNCTION__ << "\n";
770       return ExprEmpty();
771     }
772
773     virtual OwningExprResult ActOnCXXThrow(SourceLocation OpLoc, ExprArg Op) {
774       Out << __FUNCTION__ << "\n";
775       return ExprEmpty();
776     }
777
778     virtual OwningExprResult ActOnCXXTypeConstructExpr(SourceRange TypeRange,
779                                                      TypeTy *TypeRep,
780                                                      SourceLocation LParenLoc,
781                                                      MultiExprArg Exprs,
782                                                      SourceLocation *CommaLocs,
783                                                      SourceLocation RParenLoc) {
784       Out << __FUNCTION__ << "\n";
785       return ExprEmpty();
786     }
787
788     virtual OwningExprResult ActOnCXXConditionDeclarationExpr(Scope *S,
789                                                         SourceLocation StartLoc,
790                                                         Declarator &D,
791                                                         SourceLocation EqualLoc,
792                                                         ExprArg AssignExprVal) {
793       Out << __FUNCTION__ << "\n";
794       return ExprEmpty();
795     }
796
797     virtual OwningExprResult ActOnCXXNew(SourceLocation StartLoc,
798                                          bool UseGlobal,
799                                          SourceLocation PlacementLParen,
800                                          MultiExprArg PlacementArgs,
801                                          SourceLocation PlacementRParen,
802                                          bool ParenTypeId, Declarator &D,
803                                          SourceLocation ConstructorLParen,
804                                          MultiExprArg ConstructorArgs,
805                                          SourceLocation ConstructorRParen) {
806       Out << __FUNCTION__ << "\n";
807       return ExprEmpty();
808     }
809
810     virtual OwningExprResult ActOnCXXDelete(SourceLocation StartLoc,
811                                             bool UseGlobal, bool ArrayForm,
812                                             ExprArg Operand) {
813       Out << __FUNCTION__ << "\n";
814       return ExprEmpty();
815     }
816
817     virtual OwningExprResult ActOnUnaryTypeTrait(UnaryTypeTrait OTT,
818                                                  SourceLocation KWLoc,
819                                                  SourceLocation LParen,
820                                                  TypeTy *Ty,
821                                                  SourceLocation RParen) {
822       Out << __FUNCTION__ << "\n";
823       return ExprEmpty();
824     }
825   };
826 }
827
828 MinimalAction *clang::CreatePrintParserActionsAction(Preprocessor &PP,
829                                                      llvm::raw_ostream* OS) {
830   return new ParserPrintActions(PP, *OS);
831 }