diff options
32 files changed, 1080 insertions, 1124 deletions
diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h index 23e7f39bd0..fd91acff7f 100644 --- a/include/clang/Parse/Parser.h +++ b/include/clang/Parse/Parser.h @@ -147,7 +147,6 @@ public: // different actual classes based on the actions in place. typedef Action::ExprTy ExprTy; typedef Action::StmtTy StmtTy; - typedef Action::DeclPtrTy DeclPtrTy; typedef Action::DeclGroupPtrTy DeclGroupPtrTy; typedef Action::TypeTy TypeTy; typedef Action::BaseTy BaseTy; @@ -539,7 +538,7 @@ private: // Lexing and parsing of C++ inline methods. struct LexedMethod { - Action::DeclPtrTy D; + Decl *D; CachedTokens Toks; /// \brief Whether this member function had an associated template @@ -547,7 +546,7 @@ private: /// othewise, it is a member function declaration. bool TemplateScope; - explicit LexedMethod(Action::DeclPtrTy MD) : D(MD), TemplateScope(false) {} + explicit LexedMethod(Decl *MD) : D(MD), TemplateScope(false) {} }; /// LateParsedDefaultArgument - Keeps track of a parameter that may @@ -555,12 +554,12 @@ private: /// occurs within a member function declaration inside the class /// (C++ [class.mem]p2). struct LateParsedDefaultArgument { - explicit LateParsedDefaultArgument(Action::DeclPtrTy P, + explicit LateParsedDefaultArgument(Decl *P, CachedTokens *Toks = 0) : Param(P), Toks(Toks) { } /// Param - The parameter declaration for this parameter. - Action::DeclPtrTy Param; + Decl *Param; /// Toks - The sequence of tokens that comprises the default /// argument expression, not including the '=' or the terminating @@ -574,11 +573,11 @@ private: /// until the class itself is completely-defined, such as a default /// argument (C++ [class.mem]p2). struct LateParsedMethodDeclaration { - explicit LateParsedMethodDeclaration(Action::DeclPtrTy M) + explicit LateParsedMethodDeclaration(Decl *M) : Method(M), TemplateScope(false) { } /// Method - The method declaration. - Action::DeclPtrTy Method; + Decl *Method; /// \brief Whether this member function had an associated template /// scope. When true, D is a template declaration. @@ -609,7 +608,7 @@ private: /// any member function declarations or definitions that need to be /// parsed after the corresponding top-level class is complete. struct ParsingClass { - ParsingClass(DeclPtrTy TagOrTemplate, bool TopLevelClass) + ParsingClass(Decl *TagOrTemplate, bool TopLevelClass) : TopLevelClass(TopLevelClass), TemplateScope(false), TagOrTemplate(TagOrTemplate) { } @@ -623,7 +622,7 @@ private: bool TemplateScope : 1; /// \brief The class or class template whose definition we are parsing. - DeclPtrTy TagOrTemplate; + Decl *TagOrTemplate; /// MethodDecls - Method declarations that contain pieces whose /// parsing will be delayed until the class is fully defined. @@ -687,10 +686,10 @@ private: /// Signals that the context was completed without an appropriate /// declaration being parsed. void abort() { - pop(DeclPtrTy()); + pop(0); } - void complete(DeclPtrTy D) { + void complete(Decl *D) { assert(!Popped && "ParsingDeclaration has already been popped!"); pop(D); } @@ -707,7 +706,7 @@ private: Popped = false; } - void pop(DeclPtrTy D) { + void pop(Decl *D) { if (!Popped) { Actions.PopParsingDeclaration(State, D); Popped = true; @@ -725,7 +724,7 @@ private: ParsingDeclSpec(Parser &P, ParsingDeclRAIIObject *RAII) : ParsingRAII(P, RAII) {} - void complete(DeclPtrTy D) { + void complete(Decl *D) { ParsingRAII.complete(D); } @@ -756,7 +755,7 @@ private: ParsingRAII.reset(); } - void complete(DeclPtrTy D) { + void complete(Decl *D) { ParsingRAII.complete(D); } }; @@ -767,7 +766,7 @@ private: bool Popped; public: - ParsingClassDefinition(Parser &P, DeclPtrTy TagOrTemplate, bool TopLevelClass) + ParsingClassDefinition(Parser &P, Decl *TagOrTemplate, bool TopLevelClass) : P(P), Popped(false) { P.PushParsingClass(TagOrTemplate, TopLevelClass); } @@ -833,12 +832,12 @@ private: bool LastParameterListWasEmpty; }; - void PushParsingClass(DeclPtrTy TagOrTemplate, bool TopLevelClass); + void PushParsingClass(Decl *TagOrTemplate, bool TopLevelClass); void DeallocateParsedClasses(ParsingClass *Class); void PopParsingClass(); - DeclPtrTy ParseCXXInlineMethodDef(AccessSpecifier AS, Declarator &D, - const ParsedTemplateInfo &TemplateInfo); + Decl *ParseCXXInlineMethodDef(AccessSpecifier AS, Declarator &D, + const ParsedTemplateInfo &TemplateInfo); void ParseLexedMethodDeclarations(ParsingClass &Class); void ParseLexedMethodDefs(ParsingClass &Class); bool ConsumeAndStoreUntil(tok::TokenKind T1, @@ -863,7 +862,7 @@ private: AttributeList *Attr, AccessSpecifier AS = AS_none); - DeclPtrTy ParseFunctionDefinition(ParsingDeclarator &D, + Decl *ParseFunctionDefinition(ParsingDeclarator &D, const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo()); void ParseKNRParamDeclarations(Declarator &D); // EndLoc, if non-NULL, is filled with the location of the last token of @@ -872,31 +871,31 @@ private: OwningExprResult ParseAsmStringLiteral(); // Objective-C External Declarations - DeclPtrTy ParseObjCAtDirectives(); - DeclPtrTy ParseObjCAtClassDeclaration(SourceLocation atLoc); - DeclPtrTy ParseObjCAtInterfaceDeclaration(SourceLocation atLoc, + Decl *ParseObjCAtDirectives(); + Decl *ParseObjCAtClassDeclaration(SourceLocation atLoc); + Decl *ParseObjCAtInterfaceDeclaration(SourceLocation atLoc, AttributeList *prefixAttrs = 0); - void ParseObjCClassInstanceVariables(DeclPtrTy interfaceDecl, + void ParseObjCClassInstanceVariables(Decl *interfaceDecl, tok::ObjCKeywordKind visibility, SourceLocation atLoc); - bool ParseObjCProtocolReferences(llvm::SmallVectorImpl<Action::DeclPtrTy> &P, + bool ParseObjCProtocolReferences(llvm::SmallVectorImpl<Decl *> &P, llvm::SmallVectorImpl<SourceLocation> &PLocs, bool WarnOnDeclarations, SourceLocation &LAngleLoc, SourceLocation &EndProtoLoc); - void ParseObjCInterfaceDeclList(DeclPtrTy interfaceDecl, + void ParseObjCInterfaceDeclList(Decl *interfaceDecl, tok::ObjCKeywordKind contextKey); - DeclPtrTy ParseObjCAtProtocolDeclaration(SourceLocation atLoc, + Decl *ParseObjCAtProtocolDeclaration(SourceLocation atLoc, AttributeList *prefixAttrs = 0); - DeclPtrTy ObjCImpDecl; - llvm::SmallVector<DeclPtrTy, 4> PendingObjCImpDecl; + Decl *ObjCImpDecl; + llvm::SmallVector<Decl *, 4> PendingObjCImpDecl; - DeclPtrTy ParseObjCAtImplementationDeclaration(SourceLocation atLoc); - DeclPtrTy ParseObjCAtEndDeclaration(SourceRange atEnd); - DeclPtrTy ParseObjCAtAliasDeclaration(SourceLocation atLoc); - DeclPtrTy ParseObjCPropertySynthesize(SourceLocation atLoc); - DeclPtrTy ParseObjCPropertyDynamic(SourceLocation atLoc); + Decl *ParseObjCAtImplementationDeclaration(SourceLocation atLoc); + Decl *ParseObjCAtEndDeclaration(SourceRange atEnd); + Decl *ParseObjCAtAliasDeclaration(SourceLocation atLoc); + Decl *ParseObjCPropertySynthesize(SourceLocation atLoc); + Decl *ParseObjCPropertyDynamic(SourceLocation atLoc); IdentifierInfo *ParseObjCSelectorPiece(SourceLocation &MethodLocation); // Definitions for Objective-c context sensitive keywords recognition. @@ -910,15 +909,15 @@ private: TypeTy *ParseObjCTypeName(ObjCDeclSpec &DS); void ParseObjCMethodRequirement(); - DeclPtrTy ParseObjCMethodPrototype(DeclPtrTy classOrCat, + Decl *ParseObjCMethodPrototype(Decl *classOrCat, tok::ObjCKeywordKind MethodImplKind = tok::objc_not_keyword); - DeclPtrTy ParseObjCMethodDecl(SourceLocation mLoc, tok::TokenKind mType, - DeclPtrTy classDecl, + Decl *ParseObjCMethodDecl(SourceLocation mLoc, tok::TokenKind mType, + Decl *classDecl, tok::ObjCKeywordKind MethodImplKind = tok::objc_not_keyword); - void ParseObjCPropertyAttribute(ObjCDeclSpec &DS, DeclPtrTy ClassDecl, - DeclPtrTy *Methods, unsigned NumMethods); + void ParseObjCPropertyAttribute(ObjCDeclSpec &DS, Decl *ClassDecl, + Decl **Methods, unsigned NumMethods); - DeclPtrTy ParseObjCMethodDefinition(); + Decl *ParseObjCMethodDefinition(); //===--------------------------------------------------------------------===// // C99 6.5: Expressions. @@ -1049,7 +1048,7 @@ private: //===--------------------------------------------------------------------===// // C++ if/switch/while condition expression. - bool ParseCXXCondition(OwningExprResult &ExprResult, DeclPtrTy &DeclResult, + bool ParseCXXCondition(OwningExprResult &ExprResult, Decl *&DeclResult, SourceLocation Loc, bool ConvertToBoolean); //===--------------------------------------------------------------------===// @@ -1107,7 +1106,7 @@ private: bool isStmtExpr = false); OwningStmtResult ParseCompoundStatementBody(bool isStmtExpr = false); bool ParseParenExprOrCondition(OwningExprResult &ExprResult, - DeclPtrTy &DeclResult, + Decl *&DeclResult, SourceLocation Loc, bool ConvertToBoolean); OwningStmtResult ParseIfStatement(AttributeList *Attr); @@ -1162,10 +1161,10 @@ private: DeclGroupPtrTy ParseDeclGroup(ParsingDeclSpec &DS, unsigned Context, bool AllowFunctionDefinitions, SourceLocation *DeclEnd = 0); - DeclPtrTy ParseDeclarationAfterDeclarator(Declarator &D, + Decl *ParseDeclarationAfterDeclarator(Declarator &D, const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo()); - DeclPtrTy ParseFunctionStatementBody(DeclPtrTy Decl); - DeclPtrTy ParseFunctionTryBlock(DeclPtrTy Decl); + Decl *ParseFunctionStatementBody(Decl *Decl); + Decl *ParseFunctionTryBlock(Decl *Decl); bool ParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS, const ParsedTemplateInfo &TemplateInfo, @@ -1187,12 +1186,12 @@ private: void ParseEnumSpecifier(SourceLocation TagLoc, DeclSpec &DS, const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(), AccessSpecifier AS = AS_none); - void ParseEnumBody(SourceLocation StartLoc, DeclPtrTy TagDecl); + void ParseEnumBody(SourceLocation StartLoc, Decl *TagDecl); void ParseStructUnionBody(SourceLocation StartLoc, unsigned TagType, - DeclPtrTy TagDecl); + Decl *TagDecl); struct FieldCallback { - virtual DeclPtrTy invoke(FieldDeclarator &Field) = 0; + virtual Decl *invoke(FieldDeclarator &Field) = 0; virtual ~FieldCallback() {} private: @@ -1408,19 +1407,19 @@ private: bool isCXX0XAttributeSpecifier(bool FullLookahead = false, tok::TokenKind *After = 0); - DeclPtrTy ParseNamespace(unsigned Context, SourceLocation &DeclEnd); - DeclPtrTy ParseLinkage(ParsingDeclSpec &DS, unsigned Context); - DeclPtrTy ParseUsingDirectiveOrDeclaration(unsigned Context, + Decl *ParseNamespace(unsigned Context, SourceLocation &DeclEnd); + Decl *ParseLinkage(ParsingDeclSpec &DS, unsigned Context); + Decl *ParseUsingDirectiveOrDeclaration(unsigned Context, SourceLocation &DeclEnd, CXX0XAttributeList Attrs); - DeclPtrTy ParseUsingDirective(unsigned Context, SourceLocation UsingLoc, + Decl *ParseUsingDirective(unsigned Context, SourceLocation UsingLoc, SourceLocation &DeclEnd, AttributeList *Attr); - DeclPtrTy ParseUsingDeclaration(unsigned Context, SourceLocation UsingLoc, + Decl *ParseUsingDeclaration(unsigned Context, SourceLocation UsingLoc, SourceLocation &DeclEnd, AccessSpecifier AS = AS_none); - DeclPtrTy ParseStaticAssertDeclaration(SourceLocation &DeclEnd); - DeclPtrTy ParseNamespaceAlias(SourceLocation NamespaceLoc, + Decl *ParseStaticAssertDeclaration(SourceLocation &DeclEnd); + Decl *ParseNamespaceAlias(SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, SourceLocation &DeclEnd); @@ -1434,19 +1433,19 @@ private: AccessSpecifier AS = AS_none, bool SuppressDeclarations = false); void ParseCXXMemberSpecification(SourceLocation StartLoc, unsigned TagType, - DeclPtrTy TagDecl); + Decl *TagDecl); void ParseCXXClassMemberDeclaration(AccessSpecifier AS, const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(), ParsingDeclRAIIObject *DiagsFromTParams = 0); - void ParseConstructorInitializer(DeclPtrTy ConstructorDecl); - MemInitResult ParseMemInitializer(DeclPtrTy ConstructorDecl); + void ParseConstructorInitializer(Decl *ConstructorDecl); + MemInitResult ParseMemInitializer(Decl *ConstructorDecl); void HandleMemberFunctionDefaultArgs(Declarator& DeclaratorInfo, - DeclPtrTy ThisDecl); + Decl *ThisDecl); //===--------------------------------------------------------------------===// // C++ 10: Derived classes [class.derived] - void ParseBaseClause(DeclPtrTy ClassDecl); - BaseResult ParseBaseSpecifier(DeclPtrTy ClassDecl); + void ParseBaseClause(Decl *ClassDecl); + BaseResult ParseBaseSpecifier(Decl *ClassDecl); AccessSpecifier getAccessSpecifierIfPresent() const; bool ParseUnqualifiedIdTemplateId(CXXScopeSpec &SS, @@ -1468,16 +1467,16 @@ private: //===--------------------------------------------------------------------===// // C++ 14: Templates [temp] - typedef llvm::SmallVector<DeclPtrTy, 4> TemplateParameterList; + typedef llvm::SmallVector<Decl *, 4> TemplateParameterList; // C++ 14.1: Template Parameters [temp.param] - DeclPtrTy ParseDeclarationStartingWithTemplate(unsigned Context, + Decl *ParseDeclarationStartingWithTemplate(unsigned Context, SourceLocation &DeclEnd, AccessSpecifier AS = AS_none); - DeclPtrTy ParseTemplateDeclarationOrSpecialization(unsigned Context, + Decl *ParseTemplateDeclarationOrSpecialization(unsigned Context, SourceLocation &DeclEnd, AccessSpecifier AS); - DeclPtrTy ParseSingleDeclarationAfterTemplate( + Decl *ParseSingleDeclarationAfterTemplate( unsigned Context, const ParsedTemplateInfo &TemplateInfo, ParsingDeclRAIIObject &DiagsFromParams, @@ -1490,10 +1489,10 @@ private: bool ParseTemplateParameterList(unsigned Depth, TemplateParameterList &TemplateParams); bool isStartOfTemplateTypeParameter(); - DeclPtrTy ParseTemplateParameter(unsigned Depth, unsigned Position); - DeclPtrTy ParseTypeParameter(unsigned Depth, unsigned Position); - DeclPtrTy ParseTemplateTemplateParameter(unsigned Depth, unsigned Position); - DeclPtrTy ParseNonTypeTemplateParameter(unsigned Depth, unsigned Position); + Decl *ParseTemplateParameter(unsigned Depth, unsigned Position); + Decl *ParseTypeParameter(unsigned Depth, unsigned Position); + Decl *ParseTemplateTemplateParameter(unsigned Depth, unsigned Position); + Decl *ParseNonTypeTemplateParameter(unsigned Depth, unsigned Position); // C++ 14.3: Template arguments [temp.arg] typedef llvm::SmallVector<ParsedTemplateArgument, 16> TemplateArgList; @@ -1515,9 +1514,9 @@ private: bool ParseTemplateArgumentList(TemplateArgList &TemplateArgs); ParsedTemplateArgument ParseTemplateTemplateArgument(); ParsedTemplateArgument ParseTemplateArgument(); - DeclPtrTy ParseExplicitInstantiation(SourceLocation ExternLoc, - SourceLocation TemplateLoc, - SourceLocation &DeclEnd); + Decl *ParseExplicitInstantiation(SourceLocation ExternLoc, + SourceLocation TemplateLoc, + SourceLocation &DeclEnd); //===--------------------------------------------------------------------===// // GNU G++: Type Traits [Type-Traits.html in the GCC manual] diff --git a/include/clang/Sema/Action.h b/include/clang/Sema/Action.h index 8f1772efbe..a574333e75 100644 --- a/include/clang/Sema/Action.h +++ b/include/clang/Sema/Action.h @@ -42,15 +42,6 @@ namespace clang { class Preprocessor; class Token; - // We can re-use the low bit of expression, statement, base, and - // member-initializer pointers for the "invalid" flag of - // ActionResult. - template<> struct IsResultPtrLowBitFree<0> { static const bool value = true;}; - template<> struct IsResultPtrLowBitFree<1> { static const bool value = true;}; - template<> struct IsResultPtrLowBitFree<3> { static const bool value = true;}; - template<> struct IsResultPtrLowBitFree<4> { static const bool value = true;}; - template<> struct IsResultPtrLowBitFree<5> { static const bool value = true;}; - /// Action - As the parser reads the input file and recognizes the productions /// of the grammar, it invokes methods on this class to turn the parsed input /// into something useful: e.g. a parse tree. @@ -89,12 +80,12 @@ public: /// Expr/Stmt/Type/BaseResult - Provide a unique type to wrap /// ExprTy/StmtTy/TypeTy/BaseTy, providing strong typing and /// allowing for failure. - typedef ActionResult<0> ExprResult; - typedef ActionResult<1> StmtResult; - typedef ActionResult<2> TypeResult; - typedef ActionResult<3> BaseResult; - typedef ActionResult<4> MemInitResult; - typedef ActionResult<5, DeclPtrTy> DeclResult; + typedef clang::ExprResult ExprResult; + typedef clang::StmtResult StmtResult; + typedef clang::TypeResult TypeResult; + typedef clang::BaseResult BaseResult; + typedef clang::MemInitResult MemInitResult; + typedef clang::DeclResult DeclResult; /// Same, but with ownership. typedef ASTOwningResult<&ActionBase::DeleteExpr> OwningExprResult; @@ -166,7 +157,7 @@ public: /// getDeclName - Return a pretty name for the specified decl if possible, or /// an empty string if not. This is used for pretty crash reporting. - virtual std::string getDeclName(DeclPtrTy D) { return ""; } + virtual std::string getDeclName(Decl *D) { return ""; } //===--------------------------------------------------------------------===// // Declaration Tracking Callbacks. @@ -186,13 +177,13 @@ public: /// processing a declaration of some sort. The decl will be empty /// if the declaration didn't correspond to a full declaration (or /// if the actions module returned an empty decl for it). - virtual void PopParsingDeclaration(ParsingDeclStackState S, DeclPtrTy D) { + virtual void PopParsingDeclaration(ParsingDeclStackState S, Decl *D) { } /// ConvertDeclToDeclGroup - If the parser has one decl in a context where it /// needs a decl group, it calls this to convert between the two /// representations. - virtual DeclGroupPtrTy ConvertDeclToDeclGroup(DeclPtrTy Ptr) { + virtual DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr) { return DeclGroupPtrTy(); } @@ -470,34 +461,34 @@ public: /// After this method is called, according to [C++ 3.4.1p13], if 'Dcl' is a /// static data member of class X, names should be looked up in the scope of /// class X. - virtual void ActOnCXXEnterDeclInitializer(Scope *S, DeclPtrTy Dcl) { + virtual void ActOnCXXEnterDeclInitializer(Scope *S, Decl *Dcl) { } /// ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an /// initializer for the declaration 'Dcl'. - virtual void ActOnCXXExitDeclInitializer(Scope *S, DeclPtrTy Dcl) { + virtual void ActOnCXXExitDeclInitializer(Scope *S, Decl *Dcl) { } /// ActOnDeclarator - This callback is invoked when a declarator is parsed and /// 'Init' specifies the initializer if any. This is for things like: /// "int X = 4" or "typedef int foo". /// - virtual DeclPtrTy ActOnDeclarator(Scope *S, Declarator &D) { - return DeclPtrTy(); + virtual Decl *ActOnDeclarator(Scope *S, Declarator &D) { + return 0; } /// ActOnParamDeclarator - This callback is invoked when a parameter /// declarator is parsed. This callback only occurs for functions /// with prototypes. S is the function prototype scope for the /// parameters (C++ [basic.scope.proto]). - virtual DeclPtrTy ActOnParamDeclarator(Scope *S, Declarator &D) { - return DeclPtrTy(); + virtual Decl *ActOnParamDeclarator(Scope *S, Declarator &D) { + return 0; } /// \brief Parsed an exception object declaration within an Objective-C /// @catch statement. - virtual DeclPtrTy ActOnObjCExceptionDecl(Scope *S, Declarator &D) { - return DeclPtrTy(); + virtual Decl *ActOnObjCExceptionDecl(Scope *S, Declarator &D) { + return 0; } /// AddInitializerToDecl - This action is called immediately after @@ -507,7 +498,7 @@ public: /// This allows ActOnDeclarator to register "xx" prior to parsing the /// initializer. The declaration above should still result in a warning, /// since the reference to "xx" is uninitialized. - virtual void AddInitializerToDecl(DeclPtrTy Dcl, ExprArg Init) { + virtual void AddInitializerToDecl(Decl *Dcl, ExprArg Init) { return; } @@ -515,7 +506,7 @@ public: /// if =delete is parsed. C++0x [dcl.fct.def]p10 /// Note that this can be called even for variable declarations. It's the /// action's job to reject it. - virtual void SetDeclDeleted(DeclPtrTy Dcl, SourceLocation DelLoc) { + virtual void SetDeclDeleted(Decl *Dcl, SourceLocation DelLoc) { return; } @@ -523,21 +514,21 @@ public: /// ActOnDeclarator (when an initializer is *not* present). /// If TypeContainsUndeducedAuto is true, then the type of the declarator /// has an undeduced 'auto' type somewhere. - virtual void ActOnUninitializedDecl(DeclPtrTy Dcl, + virtual void ActOnUninitializedDecl(Decl *Dcl, bool TypeContainsUndeducedAuto) { return; } /// \brief Note that the given declaration had an initializer that could not /// be parsed. - virtual void ActOnInitializerError(DeclPtrTy Dcl) { + virtual void ActOnInitializerError(Decl *Dcl) { return; } /// FinalizeDeclaratorGroup - After a sequence of declarators are parsed, this /// gives the actions implementation a chance to process the group as a whole. virtual DeclGroupPtrTy FinalizeDeclaratorGroup(Scope *S, const DeclSpec& DS, - DeclPtrTy *Group, + Decl **Group, unsigned NumDecls) { return DeclGroupPtrTy(); } @@ -554,31 +545,26 @@ public: /// ActOnStartOfFunctionDef - This is called at the start of a function /// definition, instead of calling ActOnDeclarator. The Declarator includes /// information about formal arguments that are part of this function. - virtual DeclPtrTy ActOnStartOfFunctionDef(Scope *FnBodyScope, Declarator &D) { - // Default to ActOnDeclarator. - return ActOnStartOfFunctionDef(FnBodyScope, - ActOnDeclarator(FnBodyScope, D)); - } + virtual Decl *ActOnStartOfFunctionDef(Scope *FnBodyScope, + Declarator &D) = 0; /// ActOnStartOfFunctionDef - This is called at the start of a function /// definition, after the FunctionDecl has already been created. - virtual DeclPtrTy ActOnStartOfFunctionDef(Scope *FnBodyScope, DeclPtrTy D) { - return D; - } + virtual Decl *ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D) = 0; - virtual void ActOnStartOfObjCMethodDef(Scope *FnBodyScope, DeclPtrTy D) { + virtual void ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) { return; } /// ActOnFinishFunctionBody - This is called when a function body has /// completed parsing. Decl is returned by ParseStartOfFunctionDef. - virtual DeclPtrTy ActOnFinishFunctionBody(DeclPtrTy Decl, StmtArg Body) { + virtual Decl *ActOnFinishFunctionBody(Decl *Decl, StmtArg Body) { return Decl; } - virtual DeclPtrTy ActOnFileScopeAsmDecl(SourceLocation Loc, + virtual Decl *ActOnFileScopeAsmDecl(SourceLocation Loc, ExprArg AsmString) { - return DeclPtrTy(); + return 0; } /// ActOnPopScope - This callback is called immediately before the specified @@ -591,10 +577,10 @@ public: /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with /// no declarator (e.g. "struct foo;") is parsed. - virtual DeclPtrTy ParsedFreeStandingDeclSpec(Scope *S, - AccessSpecifier Access, - DeclSpec &DS) { - return DeclPtrTy(); + virtual Decl *ParsedFreeStandingDeclSpec(Scope *S, + AccessSpecifier Access, + DeclSpec &DS) { + return 0; } /// ActOnStartLinkageSpecification - Parsed the beginning of a C++ @@ -604,20 +590,20 @@ public: /// by Lang/StrSize. LBraceLoc, if valid, provides the location of /// the '{' brace. Otherwise, this linkage specification does not /// have any braces. - virtual DeclPtrTy ActOnStartLinkageSpecification(Scope *S, - SourceLocation ExternLoc, - SourceLocation LangLoc, - llvm::StringRef Lang, - SourceLocation LBraceLoc) { - return DeclPtrTy(); + virtual Decl *ActOnStartLinkageSpecification(Scope *S, + SourceLocation ExternLoc, + SourceLocation LangLoc, + llvm::StringRef Lang, + SourceLocation LBraceLoc) { + return 0; } /// ActOnFinishLinkageSpecification - Completely the definition of /// the C++ linkage specification LinkageSpec. If RBraceLoc is /// valid, it's the position of the closing '}' brace in a linkage /// specification that uses braces. - virtual DeclPtrTy ActOnFinishLinkageSpecification(Scope *S, - DeclPtrTy LinkageSpec, + virtual Decl *ActOnFinishLinkageSpecification(Scope *S, + Decl *LinkageSpec, SourceLocation RBraceLoc) { return LinkageSpec; } @@ -684,13 +670,13 @@ public: /// by the action module. /// /// \returns the declaration to which this tag refers. - virtual DeclPtrTy ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, + virtual Decl *ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, AttributeList *Attr, AccessSpecifier AS, MultiTemplateParamsArg TemplateParameterLists, bool &OwnedDecl, bool &IsDependent) { - return DeclPtrTy(); + return 0; } /// Acts on a reference to a dependent tag name. This arises in @@ -719,60 +705,60 @@ public: /// Act on @defs() element found when parsing a structure. ClassName is the /// name of the referenced class. - virtual void ActOnDefs(Scope *S, DeclPtrTy TagD, SourceLocation DeclStart, + virtual void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart, IdentifierInfo *ClassName, - llvm::SmallVectorImpl<DeclPtrTy> &Decls) {} - virtual DeclPtrTy ActOnField(Scope *S, DeclPtrTy TagD, + llvm::SmallVectorImpl<Decl *> &Decls) {} + virtual Decl *ActOnField(Scope *S, Decl *TagD, SourceLocation DeclStart, Declarator &D, ExprTy *BitfieldWidth) { - return DeclPtrTy(); + return 0; } - virtual DeclPtrTy ActOnIvar(Scope *S, SourceLocation DeclStart, - DeclPtrTy IntfDecl, + virtual Decl *ActOnIvar(Scope *S, SourceLocation DeclStart, + Decl *IntfDecl, Declarator &D, ExprTy *BitfieldWidth, tok::ObjCKeywordKind visibility) { - return DeclPtrTy(); + return 0; } - virtual void ActOnFields(Scope* S, SourceLocation RecLoc, DeclPtrTy TagDecl, - DeclPtrTy *Fields, unsigned NumFields, + virtual void ActOnFields(Scope* S, SourceLocation RecLoc, Decl *TagDecl, + Decl **Fields, unsigned NumFields, SourceLocation LBrac, SourceLocation RBrac, AttributeList *AttrList) {} /// ActOnTagStartDefinition - Invoked when we have entered the /// scope of a tag's definition (e.g., for an enumeration, class, /// struct, or union). - virtual void ActOnTagStartDefinition(Scope *S, DeclPtrTy TagDecl) { } + virtual void ActOnTagStartDefinition(Scope *S, Decl *TagDecl) { } /// ActOnStartCXXMemberDeclarations - Invoked when we have parsed a /// C++ record definition's base-specifiers clause and are starting its /// member declarations. - virtual void ActOnStartCXXMemberDeclarations(Scope *S, DeclPtrTy TagDecl, + virtual void ActOnStartCXXMemberDeclarations(Scope *S, Decl *TagDecl, SourceLocation LBraceLoc) { } /// ActOnTagFinishDefinition - Invoked once we have finished parsing /// the definition of a tag (enumeration, class, struct, or union). /// /// The scope is the scope of the tag definition. - virtual void ActOnTagFinishDefinition(Scope *S, DeclPtrTy TagDecl, + virtual void ActOnTagFinishDefinition(Scope *S, Decl *TagDecl, SourceLocation RBraceLoc) { } /// ActOnTagDefinitionError - Invoked if there's an unrecoverable /// error parsing the definition of a tag. /// |