blob: 43dbf341e96994e6a367a3900674a7e5c481e1cc [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
171 virtual TypeResult ActOnTypeName(Scope *S, Declarator &D) {
172 llvm::cout << __FUNCTION__ << "\n";
173 return 0;
174 }
175
176 virtual DeclTy *ActOnTag(Scope *S, unsigned TagType, TagKind TK,
177 SourceLocation KWLoc, IdentifierInfo *Name,
178 SourceLocation NameLoc, AttributeList *Attr) {
179 // TagType is an instance of DeclSpec::TST, indicating what kind of tag this
180 // is (struct/union/enum/class).
181 llvm::cout << __FUNCTION__ << "\n";
182 return 0;
183 }
184
185 /// Act on @defs() element found when parsing a structure. ClassName is the
186 /// name of the referenced class.
187 virtual void ActOnDefs(Scope *S, SourceLocation DeclStart,
188 IdentifierInfo *ClassName,
189 llvm::SmallVectorImpl<DeclTy*> &Decls) {
190 llvm::cout << __FUNCTION__ << "\n";
191 }
192
193 virtual DeclTy *ActOnField(Scope *S, SourceLocation DeclStart,
194 Declarator &D, ExprTy *BitfieldWidth) {
195 llvm::cout << __FUNCTION__ << "\n";
196 return 0;
197 }
198
199 virtual DeclTy *ActOnIvar(Scope *S, SourceLocation DeclStart,
200 Declarator &D, ExprTy *BitfieldWidth,
201 tok::ObjCKeywordKind visibility) {
202 llvm::cout << __FUNCTION__ << "\n";
203 return 0;
204 }
205
206 virtual void ActOnFields(Scope* S, SourceLocation RecLoc, DeclTy *TagDecl,
207 DeclTy **Fields, unsigned NumFields,
Daniel Dunbar1bfe1c22008-10-03 02:03:53 +0000208 SourceLocation LBrac, SourceLocation RBrac,
209 AttributeList *AttrList) {
Daniel Dunbarbb8f4e62008-08-01 00:41:12 +0000210 llvm::cout << __FUNCTION__ << "\n";
211 }
212
213 virtual DeclTy *ActOnEnumConstant(Scope *S, DeclTy *EnumDecl,
214 DeclTy *LastEnumConstant,
215 SourceLocation IdLoc, IdentifierInfo *Id,
216 SourceLocation EqualLoc, ExprTy *Val) {
217 llvm::cout << __FUNCTION__ << "\n";
218 return 0;
219 }
220
221 virtual void ActOnEnumBody(SourceLocation EnumLoc, DeclTy *EnumDecl,
222 DeclTy **Elements, unsigned NumElements) {
223 llvm::cout << __FUNCTION__ << "\n";
224 }
225
226 //===--------------------------------------------------------------------===//
227 // Statement Parsing Callbacks.
228 //===--------------------------------------------------------------------===//
229
230 virtual StmtResult ActOnNullStmt(SourceLocation SemiLoc) {
231 llvm::cout << __FUNCTION__ << "\n";
232 return 0;
233 }
234
235 virtual StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R,
236 StmtTy **Elts, unsigned NumElts,
237 bool isStmtExpr) {
238 llvm::cout << __FUNCTION__ << "\n";
239 return 0;
240 }
241 virtual StmtResult ActOnDeclStmt(DeclTy *Decl, SourceLocation StartLoc,
242 SourceLocation EndLoc) {
243 llvm::cout << __FUNCTION__ << "\n";
244 return 0;
245 }
246
247 virtual StmtResult ActOnExprStmt(ExprTy *Expr) {
248 llvm::cout << __FUNCTION__ << "\n";
249 return StmtResult(Expr);
250 }
251
252 /// ActOnCaseStmt - Note that this handles the GNU 'case 1 ... 4' extension,
253 /// which can specify an RHS value.
254 virtual StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprTy *LHSVal,
255 SourceLocation DotDotDotLoc, ExprTy *RHSVal,
256 SourceLocation ColonLoc, StmtTy *SubStmt) {
257 llvm::cout << __FUNCTION__ << "\n";
258 return 0;
259 }
260 virtual StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc,
261 SourceLocation ColonLoc, StmtTy *SubStmt,
262 Scope *CurScope){
263 llvm::cout << __FUNCTION__ << "\n";
264 return 0;
265 }
266
267 virtual StmtResult ActOnLabelStmt(SourceLocation IdentLoc, IdentifierInfo *II,
268 SourceLocation ColonLoc, StmtTy *SubStmt) {
269 llvm::cout << __FUNCTION__ << "\n";
270 return 0;
271 }
272
273 virtual StmtResult ActOnIfStmt(SourceLocation IfLoc, ExprTy *CondVal,
274 StmtTy *ThenVal, SourceLocation ElseLoc,
275 StmtTy *ElseVal) {
276 llvm::cout << __FUNCTION__ << "\n";
277 return 0;
278 }
279
280 virtual StmtResult ActOnStartOfSwitchStmt(ExprTy *Cond) {
281 llvm::cout << __FUNCTION__ << "\n";
282 return 0;
283 }
284
285 virtual StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc,
286 StmtTy *Switch, ExprTy *Body) {
287 llvm::cout << __FUNCTION__ << "\n";
288 return 0;
289 }
290
291 virtual StmtResult ActOnWhileStmt(SourceLocation WhileLoc, ExprTy *Cond,
292 StmtTy *Body) {
293 llvm::cout << __FUNCTION__ << "\n";
294 return 0;
295 }
296 virtual StmtResult ActOnDoStmt(SourceLocation DoLoc, StmtTy *Body,
297 SourceLocation WhileLoc, ExprTy *Cond) {
298 llvm::cout << __FUNCTION__ << "\n";
299 return 0;
300 }
301 virtual StmtResult ActOnForStmt(SourceLocation ForLoc,
302 SourceLocation LParenLoc,
303 StmtTy *First, ExprTy *Second, ExprTy *Third,
304 SourceLocation RParenLoc, StmtTy *Body) {
305 llvm::cout << __FUNCTION__ << "\n";
306 return 0;
307 }
308 virtual StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc,
309 SourceLocation LParenLoc,
310 StmtTy *First, ExprTy *Second,
311 SourceLocation RParenLoc, StmtTy *Body) {
312 llvm::cout << __FUNCTION__ << "\n";
313 return 0;
314 }
315 virtual StmtResult ActOnGotoStmt(SourceLocation GotoLoc,
316 SourceLocation LabelLoc,
317 IdentifierInfo *LabelII) {
318 llvm::cout << __FUNCTION__ << "\n";
319 return 0;
320 }
321 virtual StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc,
322 SourceLocation StarLoc,
323 ExprTy *DestExp) {
324 llvm::cout << __FUNCTION__ << "\n";
325 return 0;
326 }
327 virtual StmtResult ActOnContinueStmt(SourceLocation ContinueLoc,
328 Scope *CurScope) {
329 llvm::cout << __FUNCTION__ << "\n";
330 return 0;
331 }
332 virtual StmtResult ActOnBreakStmt(SourceLocation GotoLoc, Scope *CurScope) {
333 llvm::cout << __FUNCTION__ << "\n";
334 return 0;
335 }
336 virtual StmtResult ActOnReturnStmt(SourceLocation ReturnLoc,
337 ExprTy *RetValExp) {
338 llvm::cout << __FUNCTION__ << "\n";
339 return 0;
340 }
341 virtual StmtResult ActOnAsmStmt(SourceLocation AsmLoc,
342 bool IsSimple,
343 bool IsVolatile,
344 unsigned NumOutputs,
345 unsigned NumInputs,
346 std::string *Names,
347 ExprTy **Constraints,
348 ExprTy **Exprs,
349 ExprTy *AsmString,
350 unsigned NumClobbers,
351 ExprTy **Clobbers,
352 SourceLocation RParenLoc) {
353 llvm::cout << __FUNCTION__ << "\n";
354 return 0;
355 }
356
357 // Objective-c statements
358 virtual StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc,
359 SourceLocation RParen, StmtTy *Parm,
360 StmtTy *Body, StmtTy *CatchList) {
361 llvm::cout << __FUNCTION__ << "\n";
362 return 0;
363 }
364
365 virtual StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc,
366 StmtTy *Body) {
367 llvm::cout << __FUNCTION__ << "\n";
368 return 0;
369 }
370
371 virtual StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc,
372 StmtTy *Try,
373 StmtTy *Catch, StmtTy *Finally) {
374 llvm::cout << __FUNCTION__ << "\n";
375 return 0;
376 }
377
378 virtual StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc,
379 StmtTy *Throw) {
380 llvm::cout << __FUNCTION__ << "\n";
381 return 0;
382 }
383
384 virtual StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
385 ExprTy *SynchExpr,
386 StmtTy *SynchBody) {
387 llvm::cout << __FUNCTION__ << "\n";
388 return 0;
389 }
390
391 //===--------------------------------------------------------------------===//
392 // Expression Parsing Callbacks.
393 //===--------------------------------------------------------------------===//
394
395 // Primary Expressions.
396
397 /// ActOnIdentifierExpr - Parse an identifier in expression context.
398 /// 'HasTrailingLParen' indicates whether or not the identifier has a '('
399 /// token immediately after it.
400 virtual ExprResult ActOnIdentifierExpr(Scope *S, SourceLocation Loc,
401 IdentifierInfo &II,
402 bool HasTrailingLParen) {
403 llvm::cout << __FUNCTION__ << "\n";
404 return 0;
405 }
406
Chris Lattnerd9f69102008-08-10 01:53:14 +0000407 virtual ExprResult ActOnPredefinedExpr(SourceLocation Loc,
Daniel Dunbarbb8f4e62008-08-01 00:41:12 +0000408 tok::TokenKind Kind) {
409 llvm::cout << __FUNCTION__ << "\n";
410 return 0;
411 }
412
413 virtual ExprResult ActOnCharacterConstant(const Token &) {
414 llvm::cout << __FUNCTION__ << "\n";
415 return 0;
416 }
417
418 virtual ExprResult ActOnNumericConstant(const Token &) {
419 llvm::cout << __FUNCTION__ << "\n";
420 return 0;
421 }
422
423 /// ActOnStringLiteral - The specified tokens were lexed as pasted string
424 /// fragments (e.g. "foo" "bar" L"baz").
425 virtual ExprResult ActOnStringLiteral(const Token *Toks, unsigned NumToks) {
426 llvm::cout << __FUNCTION__ << "\n";
427 return 0;
428 }
429
430 virtual ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R,
431 ExprTy *Val) {
432 llvm::cout << __FUNCTION__ << "\n";
433 return Val; // Default impl returns operand.
434 }
435
436 // Postfix Expressions.
437 virtual ExprResult ActOnPostfixUnaryOp(SourceLocation OpLoc,
438 tok::TokenKind Kind, ExprTy *Input) {
439 llvm::cout << __FUNCTION__ << "\n";
440 return 0;
441 }
442 virtual ExprResult ActOnArraySubscriptExpr(ExprTy *Base, SourceLocation LLoc,
443 ExprTy *Idx, SourceLocation RLoc) {
444 llvm::cout << __FUNCTION__ << "\n";
445 return 0;
446 }
447 virtual ExprResult ActOnMemberReferenceExpr(ExprTy *Base,SourceLocation OpLoc,
448 tok::TokenKind OpKind,
449 SourceLocation MemberLoc,
450 IdentifierInfo &Member) {
451 llvm::cout << __FUNCTION__ << "\n";
452 return 0;
453 }
454
455 /// ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
456 /// This provides the location of the left/right parens and a list of comma
457 /// locations. There are guaranteed to be one fewer commas than arguments,
458 /// unless there are zero arguments.
459 virtual ExprResult ActOnCallExpr(ExprTy *Fn, SourceLocation LParenLoc,
460 ExprTy **Args, unsigned NumArgs,
461 SourceLocation *CommaLocs,
462 SourceLocation RParenLoc) {
463 llvm::cout << __FUNCTION__ << "\n";
464 return 0;
465 }
466
467 // Unary Operators. 'Tok' is the token for the operator.
468 virtual ExprResult ActOnUnaryOp(SourceLocation OpLoc, tok::TokenKind Op,
469 ExprTy *Input) {
470 llvm::cout << __FUNCTION__ << "\n";
471 return 0;
472 }
473 virtual ExprResult
474 ActOnSizeOfAlignOfTypeExpr(SourceLocation OpLoc, bool isSizeof,
475 SourceLocation LParenLoc, TypeTy *Ty,
476 SourceLocation RParenLoc) {
477 llvm::cout << __FUNCTION__ << "\n";
478 return 0;
479 }
480
481 virtual ExprResult ActOnCompoundLiteral(SourceLocation LParen, TypeTy *Ty,
482 SourceLocation RParen, ExprTy *Op) {
483 llvm::cout << __FUNCTION__ << "\n";
484 return 0;
485 }
486 virtual ExprResult ActOnInitList(SourceLocation LParenLoc,
487 ExprTy **InitList, unsigned NumInit,
Chris Lattner220ad7c2008-10-26 23:35:51 +0000488 InitListDesignations &Designators,
Daniel Dunbarbb8f4e62008-08-01 00:41:12 +0000489 SourceLocation RParenLoc) {
490 llvm::cout << __FUNCTION__ << "\n";
491 return 0;
492 }
493 virtual ExprResult ActOnCastExpr(SourceLocation LParenLoc, TypeTy *Ty,
494 SourceLocation RParenLoc, ExprTy *Op) {
495 llvm::cout << __FUNCTION__ << "\n";
496 return 0;
497 }
498
499 virtual ExprResult ActOnBinOp(SourceLocation TokLoc, tok::TokenKind Kind,
500 ExprTy *LHS, ExprTy *RHS) {
501 llvm::cout << __FUNCTION__ << "\n";
502 return 0;
503 }
504
505 /// ActOnConditionalOp - Parse a ?: operation. Note that 'LHS' may be null
506 /// in the case of a the GNU conditional expr extension.
507 virtual ExprResult ActOnConditionalOp(SourceLocation QuestionLoc,
508 SourceLocation ColonLoc,
509 ExprTy *Cond, ExprTy *LHS, ExprTy *RHS){
510 llvm::cout << __FUNCTION__ << "\n";
511 return 0;
512 }
513
514 //===---------------------- GNU Extension Expressions -------------------===//
515
516 virtual ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc,
517 IdentifierInfo *LabelII) { // "&&foo"
518 llvm::cout << __FUNCTION__ << "\n";
519 return 0;
520 }
521
522 virtual ExprResult ActOnStmtExpr(SourceLocation LPLoc, StmtTy *SubStmt,
523 SourceLocation RPLoc) { // "({..})"
524 llvm::cout << __FUNCTION__ << "\n";
525 return 0;
526 }
527
528 virtual ExprResult ActOnBuiltinOffsetOf(SourceLocation BuiltinLoc,
529 SourceLocation TypeLoc, TypeTy *Arg1,
530 OffsetOfComponent *CompPtr,
531 unsigned NumComponents,
532 SourceLocation RParenLoc) {
533 llvm::cout << __FUNCTION__ << "\n";
534 return 0;
535 }
536
537 // __builtin_types_compatible_p(type1, type2)
538 virtual ExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
539 TypeTy *arg1, TypeTy *arg2,
540 SourceLocation RPLoc) {
541 llvm::cout << __FUNCTION__ << "\n";
542 return 0;
543 }
544 // __builtin_choose_expr(constExpr, expr1, expr2)
545 virtual ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc,
546 ExprTy *cond, ExprTy *expr1, ExprTy *expr2,
547 SourceLocation RPLoc) {
548 llvm::cout << __FUNCTION__ << "\n";
549 return 0;
550 }
551 // __builtin_overload(...)
552 virtual ExprResult ActOnOverloadExpr(ExprTy **Args, unsigned NumArgs,
553 SourceLocation *CommaLocs,
554 SourceLocation BuiltinLoc,
555 SourceLocation RPLoc) {
556 llvm::cout << __FUNCTION__ << "\n";
557 return 0;
558 }
559
560
561 // __builtin_va_arg(expr, type)
562 virtual ExprResult ActOnVAArg(SourceLocation BuiltinLoc,
563 ExprTy *expr, TypeTy *type,
564 SourceLocation RPLoc) {
565 llvm::cout << __FUNCTION__ << "\n";
566 return 0;
Reid Spencer5f016e22007-07-11 17:01:13 +0000567 }
568 };
569}
570
Daniel Dunbare10b0f22008-10-31 08:56:51 +0000571MinimalAction *clang::CreatePrintParserActionsAction(Preprocessor &PP) {
572 return new ParserPrintActions(PP);
Reid Spencer5f016e22007-07-11 17:01:13 +0000573}