1 //===--- Action.h - Parser Action Interface ---------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the Action and EmptyAction interface.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_PARSE_ACTION_H
15 #define LLVM_CLANG_PARSE_ACTION_H
17 #include "clang/Basic/IdentifierTable.h"
18 #include "clang/Basic/SourceLocation.h"
19 #include "clang/Basic/TokenKinds.h"
34 /// Action - As the parser reads the input file and recognizes the productions
35 /// of the grammar, it invokes methods on this class to turn the parsed input
36 /// into something useful: e.g. a parse tree.
38 /// The callback methods that this class provides are phrased as actions that
39 /// the parser has just done or is about to do when the method is called. They
40 /// are not requests that the actions module do the specified action.
42 /// All of the methods here are optional except isTypeName(), which must be
43 /// specified in order for the parse to complete accurately. The EmptyAction
44 /// class does this bare-minimum of tracking to implement this functionality.
47 /// Out-of-line virtual destructor to provide home for this class.
50 // Types - Though these don't actually enforce strong typing, they document
51 // what types are required to be identical for the actions.
58 /// ActionResult - This structure is used while parsing/acting on expressions,
59 /// stmts, etc. It encapsulates both the object returned by the action, plus
60 /// a sense of whether or not it is valid.
61 template<unsigned UID>
66 ActionResult(bool Invalid = false) : Val(0), isInvalid(Invalid) {}
67 template<typename ActualExprTy>
68 ActionResult(ActualExprTy *val) : Val(val), isInvalid(false) {}
70 const ActionResult &operator=(void *RHS) {
77 /// Expr/Stmt/TypeResult - Provide a unique type to wrap ExprTy/StmtTy/TypeTy,
78 /// providing strong typing and allowing for failure.
79 typedef ActionResult<0> ExprResult;
80 typedef ActionResult<1> StmtResult;
81 typedef ActionResult<2> TypeResult;
83 /// Deletion callbacks - Since the parser doesn't know the concrete types of
84 /// the AST nodes being generated, it must do callbacks to delete objects when
85 /// recovering from errors.
86 virtual void DeleteExpr(ExprTy *E) {}
87 virtual void DeleteStmt(StmtTy *E) {}
90 virtual void PrintStats() const {}
91 //===--------------------------------------------------------------------===//
92 // Declaration Tracking Callbacks.
93 //===--------------------------------------------------------------------===//
95 /// isTypeName - Return non-null if the specified identifier is a typedef name
96 /// in the current scope.
97 virtual DeclTy *isTypeName(const IdentifierInfo &II, Scope *S) const = 0;
99 /// ActOnDeclarator - This callback is invoked when a declarator is parsed and
100 /// 'Init' specifies the initializer if any. This is for things like:
101 /// "int X = 4" or "typedef int foo".
103 /// LastInGroup is non-null for cases where one declspec has multiple
104 /// declarators on it. For example in 'int A, B', ActOnDeclarator will be
105 /// called with LastInGroup=A when invoked for B.
106 virtual DeclTy *ActOnDeclarator(Scope *S, Declarator &D,DeclTy *LastInGroup) {
110 /// AddInitializerToDecl - This action is called immediately after
111 /// ParseDeclarator (when an initializer is present). The code is factored
112 /// this way to make sure we are able to handle the following:
113 /// void func() { int xx = xx; }
114 /// This allows ActOnDeclarator to register "xx" prior to parsing the
115 /// initializer. The declaration above should still result in a warning,
116 /// since the reference to "xx" is uninitialized.
117 virtual void AddInitializerToDecl(DeclTy *Dcl, ExprTy *Init) {
120 /// FinalizeDeclaratorGroup - After a sequence of declarators are parsed, this
121 /// gives the actions implementation a chance to process the group as a whole.
122 virtual DeclTy *FinalizeDeclaratorGroup(Scope *S, DeclTy *Group) {
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 DeclTy *ActOnStartOfFunctionDef(Scope *FnBodyScope, Declarator &D) {
130 // Default to ActOnDeclarator.
131 return ActOnDeclarator(FnBodyScope, D, 0);
134 virtual void ObjCActOnStartOfMethodDef(Scope *FnBodyScope, DeclTy *D) {
138 /// ActOnFunctionDefBody - This is called when a function body has completed
139 /// parsing. Decl is the DeclTy returned by ParseStartOfFunctionDef.
140 virtual DeclTy *ActOnFinishFunctionBody(DeclTy *Decl, StmtTy *Body) {
144 virtual DeclTy *ActOnFileScopeAsmDecl(SourceLocation Loc, ExprTy *AsmString) {
148 /// ActOnPopScope - This callback is called immediately before the specified
149 /// scope is popped and deleted.
150 virtual void ActOnPopScope(SourceLocation Loc, Scope *S) {}
152 /// ActOnTranslationUnitScope - This callback is called once, immediately
153 /// after creating the translation unit scope (in Parser::Initialize).
154 virtual void ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {}
156 /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
157 /// no declarator (e.g. "struct foo;") is parsed.
158 virtual DeclTy *ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS) {
162 virtual DeclTy *ActOnLinkageSpec(SourceLocation Loc, SourceLocation LBrace,
163 SourceLocation RBrace, const char *Lang,
164 unsigned StrSize, DeclTy *D) {
168 //===--------------------------------------------------------------------===//
169 // Type Parsing Callbacks.
170 //===--------------------------------------------------------------------===//
172 virtual TypeResult ActOnTypeName(Scope *S, Declarator &D) {
176 virtual TypeResult ActOnParamDeclaratorType(Scope *S, Declarator &D) {
181 TK_Reference, // Reference to a tag: 'struct foo *X;'
182 TK_Declaration, // Fwd decl of a tag: 'struct foo;'
183 TK_Definition // Definition of a tag: 'struct foo { int X; } Y;'
185 virtual DeclTy *ActOnTag(Scope *S, unsigned TagType, TagKind TK,
186 SourceLocation KWLoc, IdentifierInfo *Name,
187 SourceLocation NameLoc, AttributeList *Attr) {
188 // TagType is an instance of DeclSpec::TST, indicating what kind of tag this
189 // is (struct/union/enum/class).
193 virtual DeclTy *ActOnField(Scope *S, DeclTy *TagDecl,SourceLocation DeclStart,
194 Declarator &D, ExprTy *BitfieldWidth) {
197 virtual void ActOnFields(Scope* S, SourceLocation RecLoc, DeclTy *TagDecl,
198 DeclTy **Fields, unsigned NumFields,
199 SourceLocation LBrac, SourceLocation RBrac,
200 tok::ObjCKeywordKind *visibility = 0) {}
201 virtual DeclTy *ActOnEnumConstant(Scope *S, DeclTy *EnumDecl,
202 DeclTy *LastEnumConstant,
203 SourceLocation IdLoc, IdentifierInfo *Id,
204 SourceLocation EqualLoc, ExprTy *Val) {
207 virtual void ActOnEnumBody(SourceLocation EnumLoc, DeclTy *EnumDecl,
208 DeclTy **Elements, unsigned NumElements) {}
210 //===--------------------------------------------------------------------===//
211 // Statement Parsing Callbacks.
212 //===--------------------------------------------------------------------===//
214 virtual StmtResult ActOnNullStmt(SourceLocation SemiLoc) {
218 virtual StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R,
219 StmtTy **Elts, unsigned NumElts,
223 virtual StmtResult ActOnDeclStmt(DeclTy *Decl) {
227 virtual StmtResult ActOnExprStmt(ExprTy *Expr) {
228 return StmtResult(Expr);
231 /// ActOnCaseStmt - Note that this handles the GNU 'case 1 ... 4' extension,
232 /// which can specify an RHS value.
233 virtual StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprTy *LHSVal,
234 SourceLocation DotDotDotLoc, ExprTy *RHSVal,
235 SourceLocation ColonLoc, StmtTy *SubStmt) {
238 virtual StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc,
239 SourceLocation ColonLoc, StmtTy *SubStmt,
244 virtual StmtResult ActOnLabelStmt(SourceLocation IdentLoc, IdentifierInfo *II,
245 SourceLocation ColonLoc, StmtTy *SubStmt) {
249 virtual StmtResult ActOnIfStmt(SourceLocation IfLoc, ExprTy *CondVal,
250 StmtTy *ThenVal, SourceLocation ElseLoc,
255 virtual StmtResult ActOnStartOfSwitchStmt(ExprTy *Cond) {
259 virtual StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc,
260 StmtTy *Switch, ExprTy *Body) {
264 virtual StmtResult ActOnWhileStmt(SourceLocation WhileLoc, ExprTy *Cond,
268 virtual StmtResult ActOnDoStmt(SourceLocation DoLoc, StmtTy *Body,
269 SourceLocation WhileLoc, ExprTy *Cond) {
272 virtual StmtResult ActOnForStmt(SourceLocation ForLoc,
273 SourceLocation LParenLoc,
274 StmtTy *First, ExprTy *Second, ExprTy *Third,
275 SourceLocation RParenLoc, StmtTy *Body) {
278 virtual StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc,
279 SourceLocation LParenLoc,
280 StmtTy *First, ExprTy *Second,
281 SourceLocation RParenLoc, StmtTy *Body) {
284 virtual StmtResult ActOnGotoStmt(SourceLocation GotoLoc,
285 SourceLocation LabelLoc,
286 IdentifierInfo *LabelII) {
289 virtual StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc,
290 SourceLocation StarLoc,
294 virtual StmtResult ActOnContinueStmt(SourceLocation ContinueLoc,
298 virtual StmtResult ActOnBreakStmt(SourceLocation GotoLoc, Scope *CurScope) {
301 virtual StmtResult ActOnReturnStmt(SourceLocation ReturnLoc,
305 virtual StmtResult ActOnAsmStmt(SourceLocation AsmLoc,
311 ExprTy **Constraints,
314 unsigned NumClobbers,
316 SourceLocation RParenLoc) {
320 // Objective-c statements
321 virtual StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc,
322 SourceLocation RParen, StmtTy *Parm,
323 StmtTy *Body, StmtTy *CatchList) {
327 virtual StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc,
332 virtual StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc,
334 StmtTy *Catch, StmtTy *Finally) {
338 virtual StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc,
343 virtual StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
349 //===--------------------------------------------------------------------===//
350 // Expression Parsing Callbacks.
351 //===--------------------------------------------------------------------===//
353 // Primary Expressions.
355 /// ActOnIdentifierExpr - Parse an identifier in expression context.
356 /// 'HasTrailingLParen' indicates whether or not the identifier has a '('
357 /// token immediately after it.
358 virtual ExprResult ActOnIdentifierExpr(Scope *S, SourceLocation Loc,
360 bool HasTrailingLParen) {
364 virtual ExprResult ActOnPreDefinedExpr(SourceLocation Loc,
365 tok::TokenKind Kind) {
368 virtual ExprResult ActOnCharacterConstant(const Token &) { return 0; }
369 virtual ExprResult ActOnNumericConstant(const Token &) { return 0; }
371 /// ActOnStringLiteral - The specified tokens were lexed as pasted string
372 /// fragments (e.g. "foo" "bar" L"baz").
373 virtual ExprResult ActOnStringLiteral(const Token *Toks, unsigned NumToks) {
377 virtual ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R,
379 return Val; // Default impl returns operand.
382 // Postfix Expressions.
383 virtual ExprResult ActOnPostfixUnaryOp(SourceLocation OpLoc,
384 tok::TokenKind Kind, ExprTy *Input) {
387 virtual ExprResult ActOnArraySubscriptExpr(ExprTy *Base, SourceLocation LLoc,
388 ExprTy *Idx, SourceLocation RLoc) {
391 virtual ExprResult ActOnMemberReferenceExpr(ExprTy *Base,SourceLocation OpLoc,
392 tok::TokenKind OpKind,
393 SourceLocation MemberLoc,
394 IdentifierInfo &Member) {
398 /// ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
399 /// This provides the location of the left/right parens and a list of comma
400 /// locations. There are guaranteed to be one fewer commas than arguments,
401 /// unless there are zero arguments.
402 virtual ExprResult ActOnCallExpr(ExprTy *Fn, SourceLocation LParenLoc,
403 ExprTy **Args, unsigned NumArgs,
404 SourceLocation *CommaLocs,
405 SourceLocation RParenLoc) {
409 // Unary Operators. 'Tok' is the token for the operator.
410 virtual ExprResult ActOnUnaryOp(SourceLocation OpLoc, tok::TokenKind Op,
415 ActOnSizeOfAlignOfTypeExpr(SourceLocation OpLoc, bool isSizeof,
416 SourceLocation LParenLoc, TypeTy *Ty,
417 SourceLocation RParenLoc) {
421 virtual ExprResult ActOnCompoundLiteral(SourceLocation LParen, TypeTy *Ty,
422 SourceLocation RParen, ExprTy *Op) {
425 virtual ExprResult ActOnInitList(SourceLocation LParenLoc,
426 ExprTy **InitList, unsigned NumInit,
427 SourceLocation RParenLoc) {
430 virtual ExprResult ActOnCastExpr(SourceLocation LParenLoc, TypeTy *Ty,
431 SourceLocation RParenLoc, ExprTy *Op) {
435 virtual ExprResult ActOnBinOp(SourceLocation TokLoc, tok::TokenKind Kind,
436 ExprTy *LHS, ExprTy *RHS) {
440 /// ActOnConditionalOp - Parse a ?: operation. Note that 'LHS' may be null
441 /// in the case of a the GNU conditional expr extension.
442 virtual ExprResult ActOnConditionalOp(SourceLocation QuestionLoc,
443 SourceLocation ColonLoc,
444 ExprTy *Cond, ExprTy *LHS, ExprTy *RHS){
448 //===---------------------- GNU Extension Expressions -------------------===//
450 virtual ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc,
451 IdentifierInfo *LabelII) { // "&&foo"
455 virtual ExprResult ActOnStmtExpr(SourceLocation LPLoc, StmtTy *SubStmt,
456 SourceLocation RPLoc) { // "({..})"
460 // __builtin_offsetof(type, identifier(.identifier|[expr])*)
461 struct OffsetOfComponent {
462 SourceLocation LocStart, LocEnd;
463 bool isBrackets; // true if [expr], false if .ident
465 IdentifierInfo *IdentInfo;
470 virtual ExprResult ActOnBuiltinOffsetOf(SourceLocation BuiltinLoc,
471 SourceLocation TypeLoc, TypeTy *Arg1,
472 OffsetOfComponent *CompPtr,
473 unsigned NumComponents,
474 SourceLocation RParenLoc) {
478 // __builtin_types_compatible_p(type1, type2)
479 virtual ExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
480 TypeTy *arg1, TypeTy *arg2,
481 SourceLocation RPLoc) {
484 // __builtin_choose_expr(constExpr, expr1, expr2)
485 virtual ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc,
486 ExprTy *cond, ExprTy *expr1, ExprTy *expr2,
487 SourceLocation RPLoc) {
490 // __builtin_overload(...)
491 virtual ExprResult ActOnOverloadExpr(ExprTy **Args, unsigned NumArgs,
492 SourceLocation *CommaLocs,
493 SourceLocation BuiltinLoc,
494 SourceLocation RPLoc) {
499 // __builtin_va_arg(expr, type)
500 virtual ExprResult ActOnVAArg(SourceLocation BuiltinLoc,
501 ExprTy *expr, TypeTy *type,
502 SourceLocation RPLoc) {
506 //===------------------------- C++ Expressions --------------------------===//
508 /// ActOnCXXCasts - Parse {dynamic,static,reinterpret,const}_cast's.
509 virtual ExprResult ActOnCXXCasts(SourceLocation OpLoc, tok::TokenKind Kind,
510 SourceLocation LAngleBracketLoc, TypeTy *Ty,
511 SourceLocation RAngleBracketLoc,
512 SourceLocation LParenLoc, ExprTy *Op,
513 SourceLocation RParenLoc) {
517 /// ActOnCXXBoolLiteral - Parse {true,false} literals.
518 virtual ExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc,
519 tok::TokenKind Kind) {
523 /// ActOnCXXThrow - Parse throw expressions.
524 virtual ExprResult ActOnCXXThrow(SourceLocation OpLoc,
528 //===----------------------- Obj-C Declarations -------------------------===//
530 // ActOnStartClassInterface - this action is called immdiately after parsing
531 // the prologue for a class interface (before parsing the instance
532 // variables). Instance variables are processed by ActOnFields().
533 virtual DeclTy *ActOnStartClassInterface(
534 SourceLocation AtInterafceLoc,
535 IdentifierInfo *ClassName,
536 SourceLocation ClassLoc,
537 IdentifierInfo *SuperName,
538 SourceLocation SuperLoc,
539 IdentifierInfo **ProtocolNames,
540 unsigned NumProtocols,
541 SourceLocation EndProtoLoc,
542 AttributeList *AttrList) {
546 /// ActOnCompatiblityAlias - this action is called after complete parsing of
547 /// @compaatibility_alias declaration. It sets up the alias relationships.
548 virtual DeclTy *ActOnCompatiblityAlias(
549 SourceLocation AtCompatibilityAliasLoc,
550 IdentifierInfo *AliasName, SourceLocation AliasLocation,
551 IdentifierInfo *ClassName, SourceLocation ClassLocation) {
555 // ActOnStartProtocolInterface - this action is called immdiately after
556 // parsing the prologue for a protocol interface.
557 virtual DeclTy *ActOnStartProtocolInterface(
558 SourceLocation AtProtoInterfaceLoc,
559 IdentifierInfo *ProtocolName,
560 SourceLocation ProtocolLoc,
561 IdentifierInfo **ProtoRefNames,
562 unsigned NumProtoRefs,
563 SourceLocation EndProtoLoc) {
566 // ActOnStartCategoryInterface - this action is called immdiately after
567 // parsing the prologue for a category interface.
568 virtual DeclTy *ActOnStartCategoryInterface(
569 SourceLocation AtInterfaceLoc,
570 IdentifierInfo *ClassName,
571 SourceLocation ClassLoc,
572 IdentifierInfo *CategoryName,
573 SourceLocation CategoryLoc,
574 IdentifierInfo **ProtoRefNames,
575 unsigned NumProtoRefs,
576 SourceLocation EndProtoLoc) {
579 // ActOnStartClassImplementation - this action is called immdiately after
580 // parsing the prologue for a class implementation. Instance variables are
581 // processed by ActOnFields().
582 virtual DeclTy *ActOnStartClassImplementation(
583 SourceLocation AtClassImplLoc,
584 IdentifierInfo *ClassName,
585 SourceLocation ClassLoc,
586 IdentifierInfo *SuperClassname,
587 SourceLocation SuperClassLoc) {
590 // ActOnStartCategoryImplementation - this action is called immdiately after
591 // parsing the prologue for a category implementation.
592 virtual DeclTy *ActOnStartCategoryImplementation(
593 SourceLocation AtCatImplLoc,
594 IdentifierInfo *ClassName,
595 SourceLocation ClassLoc,
596 IdentifierInfo *CatName,
597 SourceLocation CatLoc) {
600 // ActOnMethodDeclaration - called for all method declarations.
601 virtual DeclTy *ActOnMethodDeclaration(
602 SourceLocation BeginLoc, // location of the + or -.
603 SourceLocation EndLoc, // location of the ; or {.
604 tok::TokenKind MethodType, // tok::minus for instance, tok::plus for class.
605 DeclTy *ClassDecl, // class this methods belongs to.
606 ObjCDeclSpec &ReturnQT, // for return type's in inout etc.
607 TypeTy *ReturnType, // the method return type.
608 Selector Sel, // a unique name for the method.
609 ObjCDeclSpec *ArgQT, // for arguments' in inout etc.
610 TypeTy **ArgTypes, // non-zero when Sel.getNumArgs() > 0
611 IdentifierInfo **ArgNames, // non-zero when Sel.getNumArgs() > 0
612 AttributeList *AttrList, // optional
613 // tok::objc_not_keyword, tok::objc_optional, tok::objc_required
614 tok::ObjCKeywordKind impKind,
615 bool isVariadic = false) {
618 // ActOnAtEnd - called to mark the @end. For declarations (interfaces,
619 // protocols, categories), the parser passes all methods/properties.
620 // For class implementations, these values default to 0. For implementations,
621 // methods are processed incrementally (by ActOnMethodDeclaration above).
622 virtual void ActOnAtEnd(
623 SourceLocation AtEndLoc,
625 DeclTy **allMethods = 0,
627 DeclTy **allProperties = 0,
631 // ActOnAddObjCProperties - called to build one property AST
632 virtual DeclTy *ActOnAddObjCProperties (SourceLocation AtLoc,
633 DeclTy **allProperties, unsigned NumProperties, ObjCDeclSpec &DS) {
637 // ActOnClassMessage - used for both unary and keyword messages.
638 // ArgExprs is optional - if it is present, the number of expressions
639 // is obtained from NumArgs.
640 virtual ExprResult ActOnClassMessage(
642 IdentifierInfo *receivingClassName,
644 SourceLocation lbrac,
645 SourceLocation rbrac,
646 ExprTy **ArgExprs, unsigned NumArgs) {
649 // ActOnInstanceMessage - used for both unary and keyword messages.
650 // ArgExprs is optional - if it is present, the number of expressions
651 // is obtained from NumArgs.
652 virtual ExprResult ActOnInstanceMessage(
653 ExprTy *receiver, Selector Sel,
654 SourceLocation lbrac, SourceLocation rbrac,
655 ExprTy **ArgExprs, unsigned NumArgs) {
658 virtual DeclTy *ActOnForwardClassDeclaration(
659 SourceLocation AtClassLoc,
660 IdentifierInfo **IdentList,
664 virtual DeclTy *ActOnForwardProtocolDeclaration(
665 SourceLocation AtProtocolLoc,
666 IdentifierInfo **IdentList,
671 /// FindProtocolDeclaration - This routine looks up protocols and
672 /// issues error if they are not declared. It returns list of valid
674 virtual void FindProtocolDeclaration(SourceLocation TypeLoc,
675 IdentifierInfo **ProtocolId,
676 unsigned NumProtocols,
677 llvm::SmallVector<DeclTy *, 8> &
682 //===----------------------- Obj-C Expressions --------------------------===//
684 virtual ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs,
686 unsigned NumStrings) {
690 virtual ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc,
691 SourceLocation EncLoc,
692 SourceLocation LParenLoc,
694 SourceLocation RParenLoc) {
698 virtual ExprResult ParseObjCSelectorExpression(Selector Sel,
699 SourceLocation AtLoc,
700 SourceLocation SelLoc,
701 SourceLocation LParenLoc,
702 SourceLocation RParenLoc) {
706 virtual ExprResult ParseObjCProtocolExpression(IdentifierInfo *ProtocolId,
707 SourceLocation AtLoc,
708 SourceLocation ProtoLoc,
709 SourceLocation LParenLoc,
710 SourceLocation RParenLoc) {
715 /// MinimalAction - Minimal actions are used by light-weight clients of the
716 /// parser that do not need name resolution or significant semantic analysis to
717 /// be performed. The actions implemented here are in the form of unresolved
718 /// identifiers. By using a simpler interface than the SemanticAction class,
719 /// the parser doesn't have to build complex data structures and thus runs more
721 class MinimalAction : public Action {
722 /// Translation Unit Scope - useful to Objective-C actions that need
723 /// to lookup file scope declarations in the "ordinary" C decl namespace.
724 /// For example, user-defined classes, built-in "id" type, etc.
726 IdentifierTable &Idents;
728 MinimalAction(IdentifierTable &IT) : Idents(IT) {}
730 /// isTypeName - This looks at the IdentifierInfo::FETokenInfo field to
731 /// determine whether the name is a typedef or not in this scope.
732 virtual DeclTy *isTypeName(const IdentifierInfo &II, Scope *S) const;
734 /// ActOnDeclarator - If this is a typedef declarator, we modify the
735 /// IdentifierInfo::FETokenInfo field to keep track of this fact, until S is
737 virtual DeclTy *ActOnDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup);
739 /// ActOnPopScope - When a scope is popped, if any typedefs are now
740 /// out-of-scope, they are removed from the IdentifierInfo::FETokenInfo field.
741 virtual void ActOnPopScope(SourceLocation Loc, Scope *S);
742 virtual void ActOnTranslationUnitScope(SourceLocation Loc, Scope *S);
744 virtual DeclTy *ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
745 IdentifierInfo **IdentList,
748 virtual DeclTy *ActOnStartClassInterface(SourceLocation interLoc,
749 IdentifierInfo *ClassName, SourceLocation ClassLoc,
750 IdentifierInfo *SuperName, SourceLocation SuperLoc,
751 IdentifierInfo **ProtocolNames, unsigned NumProtocols,
752 SourceLocation EndProtoLoc, AttributeList *AttrList);
755 } // end namespace clang