blob: 8ec45f27036669e3c0c82e4230f186e28e752b35 [file] [log] [blame]
Reid Spencer5f016e22007-07-11 17:01:13 +00001//===--- PrintParserActions.cpp - Implement -parse-print-callbacks mode ---===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner0bc735f2007-12-29 19:59:25 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Reid Spencer5f016e22007-07-11 17:01:13 +00007//
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.h"
Reid Spencer5f016e22007-07-11 17:01:13 +000016#include "clang/Parse/Action.h"
17#include "clang/Parse/DeclSpec.h"
Ted Kremenekbdd30c22008-01-14 16:44:48 +000018#include "llvm/Support/Streams.h"
Reid Spencer5f016e22007-07-11 17:01:13 +000019using namespace clang;
20
21namespace {
22 class ParserPrintActions : public MinimalAction {
23
Steve Naroffb4292f22007-10-31 20:55:39 +000024 public:
Daniel Dunbare10b0f22008-10-31 08:56:51 +000025 ParserPrintActions(Preprocessor &PP) : MinimalAction(PP) {}
Daniel Dunbarbb8f4e62008-08-01 00:41:12 +000026
27 // Printing Functions which also must call MinimalAction
28
Steve Naroff08d92e42007-09-15 18:49:24 +000029 /// ActOnDeclarator - This callback is invoked when a declarator is parsed
Reid Spencer5f016e22007-07-11 17:01:13 +000030 /// and 'Init' specifies the initializer if any. This is for things like:
31 /// "int X = 4" or "typedef int foo".
Steve Naroff08d92e42007-09-15 18:49:24 +000032 virtual DeclTy *ActOnDeclarator(Scope *S, Declarator &D,
Daniel Dunbar914701e2008-08-05 16:28:08 +000033 DeclTy *LastInGroup) {
Daniel Dunbarbb8f4e62008-08-01 00:41:12 +000034 llvm::cout << __FUNCTION__ << " ";
Reid Spencer5f016e22007-07-11 17:01:13 +000035 if (IdentifierInfo *II = D.getIdentifier()) {
Ted Kremenekbdd30c22008-01-14 16:44:48 +000036 llvm::cout << "'" << II->getName() << "'";
Reid Spencer5f016e22007-07-11 17:01:13 +000037 } else {
Ted Kremenekbdd30c22008-01-14 16:44:48 +000038 llvm::cout << "<anon>";
Reid Spencer5f016e22007-07-11 17:01:13 +000039 }
Ted Kremenekbdd30c22008-01-14 16:44:48 +000040 llvm::cout << "\n";
Reid Spencer5f016e22007-07-11 17:01:13 +000041
42 // Pass up to EmptyActions so that the symbol table is maintained right.
Daniel Dunbar914701e2008-08-05 16:28:08 +000043 return MinimalAction::ActOnDeclarator(S, D, LastInGroup);
Reid Spencer5f016e22007-07-11 17:01:13 +000044 }
Steve Naroff640db422007-10-10 17:45:44 +000045 /// ActOnPopScope - This callback is called immediately before the specified
46 /// scope is popped and deleted.
47 virtual void ActOnPopScope(SourceLocation Loc, Scope *S) {
Daniel Dunbarbb8f4e62008-08-01 00:41:12 +000048 llvm::cout << __FUNCTION__ << "\n";
49 return MinimalAction::ActOnPopScope(Loc, S);
50 }
51
52 /// ActOnTranslationUnitScope - This callback is called once, immediately
53 /// after creating the translation unit scope (in Parser::Initialize).
54 virtual void ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {
55 llvm::cout << __FUNCTION__ << "\n";
56 MinimalAction::ActOnTranslationUnitScope(Loc, S);
57 }
58
59
60 Action::DeclTy *ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
61 IdentifierInfo *ClassName,
62 SourceLocation ClassLoc,
63 IdentifierInfo *SuperName,
64 SourceLocation SuperLoc,
65 DeclTy * const *ProtoRefs,
66 unsigned NumProtocols,
67 SourceLocation EndProtoLoc,
68 AttributeList *AttrList) {
69 llvm::cout << __FUNCTION__ << "\n";
70 return MinimalAction::ActOnStartClassInterface(AtInterfaceLoc,
71 ClassName, ClassLoc,
72 SuperName, SuperLoc,
73 ProtoRefs, NumProtocols,
74 EndProtoLoc, AttrList);
75 }
76
77 /// ActOnForwardClassDeclaration -
78 /// Scope will always be top level file scope.
79 Action::DeclTy *ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
80 IdentifierInfo **IdentList,
81 unsigned NumElts) {
82 llvm::cout << __FUNCTION__ << "\n";
83 return MinimalAction::ActOnForwardClassDeclaration(AtClassLoc, IdentList,
84 NumElts);
85 }
86
87 // Pure Printing
88
89 /// ActOnParamDeclarator - This callback is invoked when a parameter
90 /// declarator is parsed. This callback only occurs for functions
91 /// with prototypes. S is the function prototype scope for the
92 /// parameters (C++ [basic.scope.proto]).
93 virtual DeclTy *ActOnParamDeclarator(Scope *S, Declarator &D) {
94 llvm::cout << __FUNCTION__ << " ";
95 if (IdentifierInfo *II = D.getIdentifier()) {
96 llvm::cout << "'" << II->getName() << "'";
97 } else {
98 llvm::cout << "<anon>";
99 }
100 llvm::cout << "\n";
101 return 0;
102 }
103
104 /// AddInitializerToDecl - This action is called immediately after
105 /// ParseDeclarator (when an initializer is present). The code is factored
106 /// this way to make sure we are able to handle the following:
107 /// void func() { int xx = xx; }
108 /// This allows ActOnDeclarator to register "xx" prior to parsing the
109 /// initializer. The declaration above should still result in a warning,
110 /// since the reference to "xx" is uninitialized.
111 virtual void AddInitializerToDecl(DeclTy *Dcl, ExprTy *Init) {
112 llvm::cout << __FUNCTION__ << "\n";
113 }
114
115 /// FinalizeDeclaratorGroup - After a sequence of declarators are parsed, this
116 /// gives the actions implementation a chance to process the group as a whole.
117 virtual DeclTy *FinalizeDeclaratorGroup(Scope *S, DeclTy *Group) {
118 llvm::cout << __FUNCTION__ << "\n";
119 return 0;
120 }
121
122 /// ActOnStartOfFunctionDef - This is called at the start of a function
123 /// definition, instead of calling ActOnDeclarator. The Declarator includes
124 /// information about formal arguments that are part of this function.
125 virtual DeclTy *ActOnStartOfFunctionDef(Scope *FnBodyScope, Declarator &D) {
126 llvm::cout << __FUNCTION__ << "\n";
127 return 0;
128 }
129
130 /// ActOnStartOfFunctionDef - This is called at the start of a function
131 /// definition, after the FunctionDecl has already been created.
132 virtual DeclTy *ActOnStartOfFunctionDef(Scope *FnBodyScope, DeclTy *D) {
133 llvm::cout << __FUNCTION__ << "\n";
134 return 0;
135 }
136
137 virtual void ObjCActOnStartOfMethodDef(Scope *FnBodyScope, DeclTy *D) {
138 llvm::cout << __FUNCTION__ << "\n";
139 }
140
141 /// ActOnFunctionDefBody - This is called when a function body has completed
142 /// parsing. Decl is the DeclTy returned by ParseStartOfFunctionDef.
143 virtual DeclTy *ActOnFinishFunctionBody(DeclTy *Decl, StmtTy *Body) {
144 llvm::cout << __FUNCTION__ << "\n";
145 return 0;
146 }
147
148 virtual DeclTy *ActOnFileScopeAsmDecl(SourceLocation Loc, ExprTy *AsmString) {
149 llvm::cout << __FUNCTION__ << "\n";
150 return 0;
151 }
152
153 /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
154 /// no declarator (e.g. "struct foo;") is parsed.
155 virtual DeclTy *ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS) {
156 llvm::cout << __FUNCTION__ << "\n";
157 return 0;
158 }
159
160 virtual DeclTy *ActOnLinkageSpec(SourceLocation Loc, SourceLocation LBrace,
161 SourceLocation RBrace, const char *Lang,
162 unsigned StrSize, DeclTy *D) {
163 llvm::cout << __FUNCTION__ << "\n";
164 return 0;
165 }
166
167 //===--------------------------------------------------------------------===//
168 // Type Parsing Callbacks.
169 //===--------------------------------------------------------------------===//
170
Sebastian Redlcee63fb2008-12-02 14:43:59 +0000171 virtual TypeResult ActOnTypeName(Scope *S, Declarator &D) {
Daniel Dunbarbb8f4e62008-08-01 00:41:12 +0000172 llvm::cout << __FUNCTION__ << "\n";
173 return 0;
174 }
175
176 virtual DeclTy *ActOnTag(Scope *S, unsigned TagType, TagKind TK,
Argyrios Kyrtzidiseb83ecd2008-11-08 16:45:02 +0000177 SourceLocation KWLoc, const CXXScopeSpec &SS,
178 IdentifierInfo *Name, SourceLocation NameLoc,
179 AttributeList *Attr) {
Daniel Dunbarbb8f4e62008-08-01 00:41:12 +0000180 // TagType is an instance of DeclSpec::TST, indicating what kind of tag this
181 // is (struct/union/enum/class).
182 llvm::cout << __FUNCTION__ << "\n";
183 return 0;
184 }
185
186 /// Act on @defs() element found when parsing a structure. ClassName is the
187 /// name of the referenced class.
Douglas Gregor44b43212008-12-11 16:49:14 +0000188 virtual void ActOnDefs(Scope *S, DeclTy *TagD, SourceLocation DeclStart,
Daniel Dunbarbb8f4e62008-08-01 00:41:12 +0000189 IdentifierInfo *ClassName,
190 llvm::SmallVectorImpl<DeclTy*> &Decls) {
191 llvm::cout << __FUNCTION__ << "\n";
192 }
193
Douglas Gregor44b43212008-12-11 16:49:14 +0000194 virtual DeclTy *ActOnField(Scope *S, DeclTy *TagD,
195 SourceLocation DeclStart,
Daniel Dunbarbb8f4e62008-08-01 00:41:12 +0000196 Declarator &D, ExprTy *BitfieldWidth) {
197 llvm::cout << __FUNCTION__ << "\n";
198 return 0;
199 }
200
201 virtual DeclTy *ActOnIvar(Scope *S, SourceLocation DeclStart,
202 Declarator &D, ExprTy *BitfieldWidth,
203 tok::ObjCKeywordKind visibility) {
204 llvm::cout << __FUNCTION__ << "\n";
205 return 0;
206 }
207
208 virtual void ActOnFields(Scope* S, SourceLocation RecLoc, DeclTy *TagDecl,
209 DeclTy **Fields, unsigned NumFields,
Daniel Dunbar1bfe1c22008-10-03 02:03:53 +0000210 SourceLocation LBrac, SourceLocation RBrac,
211 AttributeList *AttrList) {
Daniel Dunbarbb8f4e62008-08-01 00:41:12 +0000212 llvm::cout << __FUNCTION__ << "\n";
213 }
214
215 virtual DeclTy *ActOnEnumConstant(Scope *S, DeclTy *EnumDecl,
216 DeclTy *LastEnumConstant,
217 SourceLocation IdLoc, IdentifierInfo *Id,
218 SourceLocation EqualLoc, ExprTy *Val) {
219 llvm::cout << __FUNCTION__ << "\n";
220 return 0;
221 }
222
223 virtual void ActOnEnumBody(SourceLocation EnumLoc, DeclTy *EnumDecl,
224 DeclTy **Elements, unsigned NumElements) {
225 llvm::cout << __FUNCTION__ << "\n";
226 }
227
228 //===--------------------------------------------------------------------===//
229 // Statement Parsing Callbacks.
230 //===--------------------------------------------------------------------===//
231
232 virtual StmtResult ActOnNullStmt(SourceLocation SemiLoc) {
233 llvm::cout << __FUNCTION__ << "\n";
234 return 0;
235 }
236
237 virtual StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R,
238 StmtTy **Elts, unsigned NumElts,
239 bool isStmtExpr) {
240 llvm::cout << __FUNCTION__ << "\n";
241 return 0;
242 }
243 virtual StmtResult ActOnDeclStmt(DeclTy *Decl, SourceLocation StartLoc,
244 SourceLocation EndLoc) {
245 llvm::cout << __FUNCTION__ << "\n";
246 return 0;
247 }
248
249 virtual StmtResult ActOnExprStmt(ExprTy *Expr) {
250 llvm::cout << __FUNCTION__ << "\n";
251 return StmtResult(Expr);
252 }
253
254 /// ActOnCaseStmt - Note that this handles the GNU 'case 1 ... 4' extension,
255 /// which can specify an RHS value.
256 virtual StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprTy *LHSVal,
257 SourceLocation DotDotDotLoc, ExprTy *RHSVal,
258 SourceLocation ColonLoc, StmtTy *SubStmt) {
259 llvm::cout << __FUNCTION__ << "\n";
260 return 0;
261 }
262 virtual StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc,
263 SourceLocation ColonLoc, StmtTy *SubStmt,
264 Scope *CurScope){
265 llvm::cout << __FUNCTION__ << "\n";
266 return 0;
267 }
268
269 virtual StmtResult ActOnLabelStmt(SourceLocation IdentLoc, IdentifierInfo *II,
270 SourceLocation ColonLoc, StmtTy *SubStmt) {
271 llvm::cout << __FUNCTION__ << "\n";
272 return 0;
273 }
274
275 virtual StmtResult ActOnIfStmt(SourceLocation IfLoc, ExprTy *CondVal,
276 StmtTy *ThenVal, SourceLocation ElseLoc,
277 StmtTy *ElseVal) {
278 llvm::cout << __FUNCTION__ << "\n";
279 return 0;
280 }
281
282 virtual StmtResult ActOnStartOfSwitchStmt(ExprTy *Cond) {
283 llvm::cout << __FUNCTION__ << "\n";
284 return 0;
285 }
286
287 virtual StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc,
288 StmtTy *Switch, ExprTy *Body) {
289 llvm::cout << __FUNCTION__ << "\n";
290 return 0;
291 }
292
293 virtual StmtResult ActOnWhileStmt(SourceLocation WhileLoc, ExprTy *Cond,
294 StmtTy *Body) {
295 llvm::cout << __FUNCTION__ << "\n";
296 return 0;
297 }
298 virtual StmtResult ActOnDoStmt(SourceLocation DoLoc, StmtTy *Body,
299 SourceLocation WhileLoc, ExprTy *Cond) {
300 llvm::cout << __FUNCTION__ << "\n";
301 return 0;
302 }
303 virtual StmtResult ActOnForStmt(SourceLocation ForLoc,
304 SourceLocation LParenLoc,
305 StmtTy *First, ExprTy *Second, ExprTy *Third,
306 SourceLocation RParenLoc, StmtTy *Body) {
307 llvm::cout << __FUNCTION__ << "\n";
308 return 0;
309 }
310 virtual StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc,
311 SourceLocation LParenLoc,
312 StmtTy *First, ExprTy *Second,
313 SourceLocation RParenLoc, StmtTy *Body) {
314 llvm::cout << __FUNCTION__ << "\n";
315 return 0;
316 }
317 virtual StmtResult ActOnGotoStmt(SourceLocation GotoLoc,
318 SourceLocation LabelLoc,
319 IdentifierInfo *LabelII) {
320 llvm::cout << __FUNCTION__ << "\n";
321 return 0;
322 }
323 virtual StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc,
324 SourceLocation StarLoc,
325 ExprTy *DestExp) {
326 llvm::cout << __FUNCTION__ << "\n";
327 return 0;
328 }
329 virtual StmtResult ActOnContinueStmt(SourceLocation ContinueLoc,
330 Scope *CurScope) {
331 llvm::cout << __FUNCTION__ << "\n";
332 return 0;
333 }
334 virtual StmtResult ActOnBreakStmt(SourceLocation GotoLoc, Scope *CurScope) {
335 llvm::cout << __FUNCTION__ << "\n";
336 return 0;
337 }
338 virtual StmtResult ActOnReturnStmt(SourceLocation ReturnLoc,
339 ExprTy *RetValExp) {
340 llvm::cout << __FUNCTION__ << "\n";
341 return 0;
342 }
343 virtual StmtResult ActOnAsmStmt(SourceLocation AsmLoc,
344 bool IsSimple,
345 bool IsVolatile,
346 unsigned NumOutputs,
347 unsigned NumInputs,
348 std::string *Names,
349 ExprTy **Constraints,
350 ExprTy **Exprs,
351 ExprTy *AsmString,
352 unsigned NumClobbers,
353 ExprTy **Clobbers,
354 SourceLocation RParenLoc) {
355 llvm::cout << __FUNCTION__ << "\n";
356 return 0;
357 }
358
359 // Objective-c statements
360 virtual StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc,
361 SourceLocation RParen, StmtTy *Parm,
362 StmtTy *Body, StmtTy *CatchList) {
363 llvm::cout << __FUNCTION__ << "\n";
364 return 0;
365 }
366
367 virtual StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc,
368 StmtTy *Body) {
369 llvm::cout << __FUNCTION__ << "\n";
370 return 0;
371 }
372
373 virtual StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc,
374 StmtTy *Try,
375 StmtTy *Catch, StmtTy *Finally) {
376 llvm::cout << __FUNCTION__ << "\n";
377 return 0;
378 }
379
380 virtual StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc,
381 StmtTy *Throw) {
382 llvm::cout << __FUNCTION__ << "\n";
383 return 0;
384 }
385
386 virtual StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
387 ExprTy *SynchExpr,
388 StmtTy *SynchBody) {
389 llvm::cout << __FUNCTION__ << "\n";
390 return 0;
391 }
392
393 //===--------------------------------------------------------------------===//
394 // Expression Parsing Callbacks.
395 //===--------------------------------------------------------------------===//
396
397 // Primary Expressions.
398
399 /// ActOnIdentifierExpr - Parse an identifier in expression context.
400 /// 'HasTrailingLParen' indicates whether or not the identifier has a '('
401 /// token immediately after it.
402 virtual ExprResult ActOnIdentifierExpr(Scope *S, SourceLocation Loc,
403 IdentifierInfo &II,
Argyrios Kyrtzidiseb83ecd2008-11-08 16:45:02 +0000404 bool HasTrailingLParen,
405 const CXXScopeSpec *SS) {
Daniel Dunbarbb8f4e62008-08-01 00:41:12 +0000406 llvm::cout << __FUNCTION__ << "\n";
407 return 0;
408 }
409
Chris Lattnerd9f69102008-08-10 01:53:14 +0000410 virtual ExprResult ActOnPredefinedExpr(SourceLocation Loc,
Daniel Dunbarbb8f4e62008-08-01 00:41:12 +0000411 tok::TokenKind Kind) {
412 llvm::cout << __FUNCTION__ << "\n";
413 return 0;
414 }
415
416 virtual ExprResult ActOnCharacterConstant(const Token &) {
417 llvm::cout << __FUNCTION__ << "\n";
418 return 0;
419 }
420
421 virtual ExprResult ActOnNumericConstant(const Token &) {
422 llvm::cout << __FUNCTION__ << "\n";
423 return 0;
424 }
425
426 /// ActOnStringLiteral - The specified tokens were lexed as pasted string
427 /// fragments (e.g. "foo" "bar" L"baz").
428 virtual ExprResult ActOnStringLiteral(const Token *Toks, unsigned NumToks) {
429 llvm::cout << __FUNCTION__ << "\n";
430 return 0;
431 }
432
433 virtual ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R,
434 ExprTy *Val) {
435 llvm::cout << __FUNCTION__ << "\n";
436 return Val; // Default impl returns operand.
437 }
438
439 // Postfix Expressions.
Douglas Gregor74253732008-11-19 15:42:04 +0000440 virtual ExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc,
Daniel Dunbarbb8f4e62008-08-01 00:41:12 +0000441 tok::TokenKind Kind, ExprTy *Input) {
442 llvm::cout << __FUNCTION__ << "\n";
443 return 0;
444 }
Douglas Gregor337c6b92008-11-19 17:17:41 +0000445 virtual ExprResult ActOnArraySubscriptExpr(Scope *S, ExprTy *Base,
446 SourceLocation LLoc, ExprTy *Idx,
447 SourceLocation RLoc) {
Daniel Dunbarbb8f4e62008-08-01 00:41:12 +0000448 llvm::cout << __FUNCTION__ << "\n";
449 return 0;
450 }
451 virtual ExprResult ActOnMemberReferenceExpr(ExprTy *Base,SourceLocation OpLoc,
452 tok::TokenKind OpKind,
453 SourceLocation MemberLoc,
454 IdentifierInfo &Member) {
455 llvm::cout << __FUNCTION__ << "\n";
456 return 0;
457 }
458
459 /// ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
460 /// This provides the location of the left/right parens and a list of comma
461 /// locations. There are guaranteed to be one fewer commas than arguments,
462 /// unless there are zero arguments.
Douglas Gregor5c37de72008-12-06 00:22:45 +0000463 virtual ExprResult ActOnCallExpr(Scope *S, ExprTy *Fn,
464 SourceLocation LParenLoc,
Daniel Dunbarbb8f4e62008-08-01 00:41:12 +0000465 ExprTy **Args, unsigned NumArgs,
466 SourceLocation *CommaLocs,
467 SourceLocation RParenLoc) {
468 llvm::cout << __FUNCTION__ << "\n";
469 return 0;
470 }
471
472 // Unary Operators. 'Tok' is the token for the operator.
Douglas Gregor74253732008-11-19 15:42:04 +0000473 virtual ExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc,
474 tok::TokenKind Op, ExprTy *Input) {
Daniel Dunbarbb8f4e62008-08-01 00:41:12 +0000475 llvm::cout << __FUNCTION__ << "\n";
476 return 0;
477 }
478 virtual ExprResult
Sebastian Redl05189992008-11-11 17:56:53 +0000479 ActOnSizeOfAlignOfExpr(SourceLocation OpLoc, bool isSizeof, bool isType,
480 void *TyOrEx, const SourceRange &ArgRange) {
Daniel Dunbarbb8f4e62008-08-01 00:41:12 +0000481 llvm::cout << __FUNCTION__ << "\n";
482 return 0;
483 }
484
485 virtual ExprResult ActOnCompoundLiteral(SourceLocation LParen, TypeTy *Ty,
486 SourceLocation RParen, ExprTy *Op) {
487 llvm::cout << __FUNCTION__ << "\n";
488 return 0;
489 }
490 virtual ExprResult ActOnInitList(SourceLocation LParenLoc,
491 ExprTy **InitList, unsigned NumInit,
Chris Lattner220ad7c2008-10-26 23:35:51 +0000492 InitListDesignations &Designators,
Daniel Dunbarbb8f4e62008-08-01 00:41:12 +0000493 SourceLocation RParenLoc) {
494 llvm::cout << __FUNCTION__ << "\n";
495 return 0;
496 }
497 virtual ExprResult ActOnCastExpr(SourceLocation LParenLoc, TypeTy *Ty,
498 SourceLocation RParenLoc, ExprTy *Op) {
499 llvm::cout << __FUNCTION__ << "\n";
500 return 0;
501 }
502
Douglas Gregoreaebc752008-11-06 23:29:22 +0000503 virtual ExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc,
504 tok::TokenKind Kind,
Daniel Dunbarbb8f4e62008-08-01 00:41:12 +0000505 ExprTy *LHS, ExprTy *RHS) {
506 llvm::cout << __FUNCTION__ << "\n";
507 return 0;
508 }
509
510 /// ActOnConditionalOp - Parse a ?: operation. Note that 'LHS' may be null
511 /// in the case of a the GNU conditional expr extension.
512 virtual ExprResult ActOnConditionalOp(SourceLocation QuestionLoc,
513 SourceLocation ColonLoc,
514 ExprTy *Cond, ExprTy *LHS, ExprTy *RHS){
515 llvm::cout << __FUNCTION__ << "\n";
516 return 0;
517 }
518
519 //===---------------------- GNU Extension Expressions -------------------===//
520
521 virtual ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc,
522 IdentifierInfo *LabelII) { // "&&foo"
523 llvm::cout << __FUNCTION__ << "\n";
524 return 0;
525 }
526
527 virtual ExprResult ActOnStmtExpr(SourceLocation LPLoc, StmtTy *SubStmt,
528 SourceLocation RPLoc) { // "({..})"
529 llvm::cout << __FUNCTION__ << "\n";
530 return 0;
531 }
532
533 virtual ExprResult ActOnBuiltinOffsetOf(SourceLocation BuiltinLoc,
534 SourceLocation TypeLoc, TypeTy *Arg1,
535 OffsetOfComponent *CompPtr,
536 unsigned NumComponents,
537 SourceLocation RParenLoc) {
538 llvm::cout << __FUNCTION__ << "\n";
539 return 0;
540 }
541
542 // __builtin_types_compatible_p(type1, type2)
543 virtual ExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
544 TypeTy *arg1, TypeTy *arg2,
545 SourceLocation RPLoc) {
546 llvm::cout << __FUNCTION__ << "\n";
547 return 0;
548 }
549 // __builtin_choose_expr(constExpr, expr1, expr2)
550 virtual ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc,
551 ExprTy *cond, ExprTy *expr1, ExprTy *expr2,
552 SourceLocation RPLoc) {
553 llvm::cout << __FUNCTION__ << "\n";
554 return 0;
555 }
556 // __builtin_overload(...)
557 virtual ExprResult ActOnOverloadExpr(ExprTy **Args, unsigned NumArgs,
558 SourceLocation *CommaLocs,
559 SourceLocation BuiltinLoc,
560 SourceLocation RPLoc) {
561 llvm::cout << __FUNCTION__ << "\n";
562 return 0;
563 }
564
565
566 // __builtin_va_arg(expr, type)
567 virtual ExprResult ActOnVAArg(SourceLocation BuiltinLoc,
568 ExprTy *expr, TypeTy *type,
569 SourceLocation RPLoc) {
570 llvm::cout << __FUNCTION__ << "\n";
571 return 0;
Reid Spencer5f016e22007-07-11 17:01:13 +0000572 }
573 };
574}
575
Daniel Dunbare10b0f22008-10-31 08:56:51 +0000576MinimalAction *clang::CreatePrintParserActionsAction(Preprocessor &PP) {
577 return new ParserPrintActions(PP);
Reid Spencer5f016e22007-07-11 17:01:13 +0000578}