diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-01-20 01:17:11 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-01-20 01:17:11 +0000 |
commit | 4afa39deaa245592977136d367251ee2c173dd8d (patch) | |
tree | b147c76b69b1dc48d42e3cc3080554515db96d94 | |
parent | f4f6f219423a67a969de7b3e0c28bcefdb3c0a10 (diff) |
Remove ScopedDecl, collapsing all of its functionality into Decl, so
that every declaration lives inside a DeclContext.
Moved several things that don't have names but were ScopedDecls (and,
therefore, NamedDecls) to inherit from Decl rather than NamedDecl,
including ObjCImplementationDecl and LinkageSpecDecl. Now, we don't
store empty DeclarationNames for these things, nor do we try to insert
them into DeclContext's lookup structure.
The serialization tests are temporarily disabled. We'll re-enable them
once we've sorted out the remaining ownership/serialiazation issues
between DeclContexts and TranslationUnion, DeclGroups, etc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62562 91177308-0d34-0410-b5e6-96231b3b80d8
42 files changed, 630 insertions, 807 deletions
diff --git a/Driver/ASTConsumers.cpp b/Driver/ASTConsumers.cpp index 6729746573..6f66307c4b 100644 --- a/Driver/ASTConsumers.cpp +++ b/Driver/ASTConsumers.cpp @@ -122,8 +122,8 @@ void DeclPrinter:: PrintDecl(Decl *D) { Out << "asm("; AD->getAsmString()->printPretty(Out); Out << ")\n"; - } else if (ScopedDecl *SD = dyn_cast<ScopedDecl>(D)) { - Out << "Read top-level variable decl: '" << SD->getNameAsString() << "'\n"; + } else if (NamedDecl *ND = dyn_cast<NamedDecl>(D)) { + Out << "Read top-level variable decl: '" << ND->getNameAsString() << "'\n"; } else { assert(0 && "Unknown decl type!"); } @@ -480,8 +480,8 @@ namespace { } } else if (TypedefDecl *TD = dyn_cast<TypedefDecl>(D)) { PrintTypeDefDecl(TD); - } else if (ScopedDecl *SD = dyn_cast<ScopedDecl>(D)) { - Out << "Read top-level variable decl: '" << SD->getNameAsString() + } else if (NamedDecl *ND = dyn_cast<NamedDecl>(D)) { + Out << "Read top-level variable decl: '" << ND->getNameAsString() << "'\n"; } else if (ObjCInterfaceDecl *OID = dyn_cast<ObjCInterfaceDecl>(D)) { Out << "Read objc interface '" << OID->getNameAsString() << "'\n"; diff --git a/Driver/RewriteBlocks.cpp b/Driver/RewriteBlocks.cpp index c729a904f6..706eef8918 100644 --- a/Driver/RewriteBlocks.cpp +++ b/Driver/RewriteBlocks.cpp @@ -1025,7 +1025,7 @@ Stmt *RewriteBlocks::RewriteFunctionBody(Stmt *S) { for (DeclStmt::decl_iterator DI = DS->decl_begin(), DE = DS->decl_end(); DI != DE; ++DI) { - ScopedDecl *SD = *DI; + Decl *SD = *DI; if (ValueDecl *ND = dyn_cast<ValueDecl>(SD)) { if (isBlockPointerType(ND->getType())) RewriteBlockPointerDecl(ND); diff --git a/Driver/RewriteObjC.cpp b/Driver/RewriteObjC.cpp index 8af30f22e8..3c797c5b6d 100644 --- a/Driver/RewriteObjC.cpp +++ b/Driver/RewriteObjC.cpp @@ -224,7 +224,7 @@ namespace { ObjCImplementationDecl *IMD, ObjCCategoryImplDecl *CID); void RewriteInterfaceDecl(ObjCInterfaceDecl *Dcl); - void RewriteImplementationDecl(NamedDecl *Dcl); + void RewriteImplementationDecl(Decl *Dcl); void RewriteObjCMethodDecl(ObjCMethodDecl *MDecl, std::string &ResultStr); void RewriteCategoryDecl(ObjCCategoryDecl *Dcl); void RewriteProtocolDecl(ObjCProtocolDecl *Dcl); @@ -967,7 +967,7 @@ void RewriteObjC::RewriteObjCMethodDecl(ObjCMethodDecl *OMD, } } } -void RewriteObjC::RewriteImplementationDecl(NamedDecl *OID) { +void RewriteObjC::RewriteImplementationDecl(Decl *OID) { ObjCImplementationDecl *IMD = dyn_cast<ObjCImplementationDecl>(OID); ObjCCategoryImplDecl *CID = dyn_cast<ObjCCategoryImplDecl>(OID); @@ -1297,7 +1297,7 @@ Stmt *RewriteObjC::RewriteObjCForCollectionStmt(ObjCForCollectionStmt *S, buf = "\n{\n\t"; if (DeclStmt *DS = dyn_cast<DeclStmt>(S->getElement())) { // type elem; - ScopedDecl* D = DS->getSolitaryDecl(); + NamedDecl* D = cast<NamedDecl>(DS->getSolitaryDecl()); QualType ElementType = cast<ValueDecl>(D)->getType(); elementTypeAsString = ElementType.getAsString(); buf += elementTypeAsString; @@ -1920,7 +1920,7 @@ void RewriteObjC::SynthSelGetUidFunctionDecl() { SelGetUidFunctionDecl = FunctionDecl::Create(*Context, TUDecl, SourceLocation(), SelGetUidIdent, getFuncType, - FunctionDecl::Extern, false, 0); + FunctionDecl::Extern, false); } // SynthGetProtocolFunctionDecl - Protocol objc_getProtocol(const char *proto); @@ -1935,7 +1935,7 @@ void RewriteObjC::SynthGetProtocolFunctionDecl() { GetProtocolFunctionDecl = FunctionDecl::Create(*Context, TUDecl, SourceLocation(), SelGetProtoIdent, getFuncType, - FunctionDecl::Extern, false, 0); + FunctionDecl::Extern, false); } void RewriteObjC::RewriteFunctionDecl(FunctionDecl *FD) { @@ -1964,7 +1964,7 @@ void RewriteObjC::SynthSuperContructorFunctionDecl() { SuperContructorFunctionDecl = FunctionDecl::Create(*Context, TUDecl, SourceLocation(), msgSendIdent, msgSendType, - FunctionDecl::Extern, false, 0); + FunctionDecl::Extern, false); } // SynthMsgSendFunctionDecl - id objc_msgSend(id self, SEL op, ...); @@ -1983,7 +1983,7 @@ void RewriteObjC::SynthMsgSendFunctionDecl() { MsgSendFunctionDecl = FunctionDecl::Create(*Context, TUDecl, SourceLocation(), msgSendIdent, msgSendType, - FunctionDecl::Extern, false, 0); + FunctionDecl::Extern, false); } // SynthMsgSendSuperFunctionDecl - id objc_msgSendSuper(struct objc_super *, SEL op, ...); @@ -2005,7 +2005,7 @@ void RewriteObjC::SynthMsgSendSuperFunctionDecl() { MsgSendSuperFunctionDecl = FunctionDecl::Create(*Context, TUDecl, SourceLocation(), msgSendIdent, msgSendType, - FunctionDecl::Extern, false, 0); + FunctionDecl::Extern, false); } // SynthMsgSendStretFunctionDecl - id objc_msgSend_stret(id self, SEL op, ...); @@ -2024,7 +2024,7 @@ void RewriteObjC::SynthMsgSendStretFunctionDecl() { MsgSendStretFunctionDecl = FunctionDecl::Create(*Context, TUDecl, SourceLocation(), msgSendIdent, msgSendType, - FunctionDecl::Extern, false, 0); + FunctionDecl::Extern, false); } // SynthMsgSendSuperStretFunctionDecl - @@ -2048,7 +2048,7 @@ void RewriteObjC::SynthMsgSendSuperStretFunctionDecl() { MsgSendSuperStretFunctionDecl = FunctionDecl::Create(*Context, TUDecl, SourceLocation(), msgSendIdent, msgSendType, - FunctionDecl::Extern, false, 0); + FunctionDecl::Extern, false); } // SynthMsgSendFpretFunctionDecl - double objc_msgSend_fpret(id self, SEL op, ...); @@ -2067,7 +2067,7 @@ void RewriteObjC::SynthMsgSendFpretFunctionDecl() { MsgSendFpretFunctionDecl = FunctionDecl::Create(*Context, TUDecl, SourceLocation(), msgSendIdent, msgSendType, - FunctionDecl::Extern, false, 0); + FunctionDecl::Extern, false); } // SynthGetClassFunctionDecl - id objc_getClass(const char *name); @@ -2082,7 +2082,7 @@ void RewriteObjC::SynthGetClassFunctionDecl() { GetClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl, SourceLocation(), getClassIdent, getClassType, - FunctionDecl::Extern, false, 0); + FunctionDecl::Extern, false); } // SynthGetMetaClassFunctionDecl - id objc_getClass(const char *name); @@ -2097,7 +2097,7 @@ void RewriteObjC::SynthGetMetaClassFunctionDecl() { GetMetaClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl, SourceLocation(), getClassIdent, getClassType, - FunctionDecl::Extern, false, 0); + FunctionDecl::Extern, false); } Stmt *RewriteObjC::RewriteObjCStringLiteral(ObjCStringLiteral *Exp) { @@ -2131,7 +2131,7 @@ Stmt *RewriteObjC::RewriteObjCStringLiteral(ObjCStringLiteral *Exp) { VarDecl *NewVD = VarDecl::Create(*Context, TUDecl, SourceLocation(), &Context->Idents.get(S.c_str()), strType, - VarDecl::Static, NULL); + VarDecl::Static); DeclRefExpr *DRE = new DeclRefExpr(NewVD, strType, SourceLocation()); Expr *Unop = new UnaryOperator(DRE, UnaryOperator::AddrOf, Context->getPointerType(DRE->getType()), @@ -2175,7 +2175,7 @@ QualType RewriteObjC::getSuperStructType() { SuperStructDecl->addDecl(FieldDecl::Create(*Context, SuperStructDecl, SourceLocation(), 0, FieldTypes[i], /*BitWidth=*/0, - /*Mutable=*/false, 0)); + /*Mutable=*/false)); } SuperStructDecl->completeDefinition(*Context); @@ -2206,7 +2206,7 @@ QualType RewriteObjC::getConstantStringStructType() { SourceLocation(), 0, FieldTypes[i], /*BitWidth=*/0, - /*Mutable=*/true, 0)); + /*Mutable=*/true)); } ConstantStringDecl->completeDefinition(*Context); @@ -3816,7 +3816,7 @@ Stmt *RewriteObjC::SynthesizeBlockCall(CallExpr *Exp) { FieldDecl *FD = FieldDecl::Create(*Context, 0, SourceLocation(), &Context->Idents.get("FuncPtr"), Context->VoidPtrTy, - /*BitWidth=*/0, /*Mutable=*/true, 0); + /*BitWidth=*/0, /*Mutable=*/true); MemberExpr *ME = new MemberExpr(PE, true, FD, SourceLocation(), FD->getType()); CastExpr *FunkCast = new CStyleCastExpr(PtrToFuncCastType, ME, PtrToFuncCastType, SourceLocation(), SourceLocation()); @@ -4021,7 +4021,7 @@ FunctionDecl *RewriteObjC::SynthBlockInitFunctionDecl(const char *name) { IdentifierInfo *ID = &Context->Idents.get(name); QualType FType = Context->getFunctionTypeNoProto(Context->VoidPtrTy); return FunctionDecl::Create(*Context, TUDecl,SourceLocation(), - ID, FType, FunctionDecl::Extern, false, 0); + ID, FType, FunctionDecl::Extern, false); } Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp) { @@ -4304,7 +4304,7 @@ Stmt *RewriteObjC::RewriteFunctionBodyOrGlobalInitializer(Stmt *S) { // Blocks rewrite rules. for (DeclStmt::decl_iterator DI = DS->decl_begin(), DE = DS->decl_end(); DI != DE; ++DI) { - ScopedDecl *SD = *DI; + Decl *SD = *DI; if (ValueDecl *ND = dyn_cast<ValueDecl>(SD)) { if (isTopLevelBlockPointerType(ND->getType())) RewriteBlockPointerDecl(ND); diff --git a/docs/InternalsManual.html b/docs/InternalsManual.html index 2fcadb7a79..27232843d3 100644 --- a/docs/InternalsManual.html +++ b/docs/InternalsManual.html @@ -1019,14 +1019,12 @@ malloc'd objects are at least 8 byte aligned.</p> (de-)serialization.</dd> </dl> -<p>The declarations stored within each declaration context are - called <i>scoped declarations</i> and the AST nodes for each of - these declarations are - derived from the <code>ScopedDecl</code> class, which provides - information about the context in which that declaration lives. One +<p>All declarations are stored within a declaration context, and one + can query + information about the context in which each declaration lives. One can retrieve the <code>DeclContext</code> that contains a - particular <code>ScopedDecl</code> - using <code>ScopedDecl::getDeclContext</code>. However, see the + particular <code>Decl</code> + using <code>Decl::getDeclContext</code>. However, see the section <a href="#LexicalAndSemanticContexts">Lexical and Semantic Contexts</a> for more information about how to interpret this context information.</p> @@ -1065,15 +1063,14 @@ void g(int); primarily use this semantics-centric view.</p> <h4 id="LexicalAndSemanticContexts">Lexical and Semantic Contexts</h4> -<p>Each scoped declaration (whose AST node derived - from <code>ScopedDecl</code>) has two potentially different +<p>Each declaration has two potentially different declaration contexts: a <i>lexical</i> context, which corresponds to the source-centric view of the declaration context, and a <i>semantic</i> context, which corresponds to the semantics-centric view. The lexical context is accessible - via <code>ScopedDecl::getLexicalDeclContext</code> while the + via <code>Decl::getLexicalDeclContext</code> while the semantic context is accessible - via <code>ScopedDecl::getDeclContext</code>, both of which return + via <code>Decl::getDeclContext</code>, both of which return <code>DeclContext</code> pointers. For most declarations, the two contexts are identical. For example:</p> diff --git a/include/clang/AST/ASTConsumer.h b/include/clang/AST/ASTConsumer.h index 2ba36b0a57..efb701e6d5 100644 --- a/include/clang/AST/ASTConsumer.h +++ b/include/clang/AST/ASTConsumer.h @@ -37,7 +37,7 @@ public: /// HandleTopLevelDecl - Handle the specified top-level declaration. This is /// called by the parser to process every top-level Decl*. Note that D can /// be the head of a chain of Decls (e.g. for `int a, b` the chain will have - /// two elements). Use ScopedDecl::getNextDeclarator() to walk the chain. + /// two elements). Use Decl::getNextDeclarator() to walk the chain. virtual void HandleTopLevelDecl(Decl *D) {} /// HandleTranslationUnit - This method is called when the ASTs for entire diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 050768fe30..988a7419a5 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -31,9 +31,10 @@ class StringLiteral; /// FIXME: The TranslationUnit class should probably be modified to serve as /// the top decl context. It would have ownership of the top decls so that the /// AST is self-contained and easily de/serializable. +/// FIXME: TranslationUnitDecl isn't really a Decl (!) class TranslationUnitDecl : public Decl, public DeclContext { TranslationUnitDecl() - : Decl(TranslationUnit, SourceLocation()), + : Decl(TranslationUnit, 0, SourceLocation()), DeclContext(TranslationUnit) {} public: static TranslationUnitDecl *Create(ASTContext &C); @@ -66,13 +67,13 @@ class NamedDecl : public Decl { DeclarationName Name; protected: - NamedDecl(Kind DK, SourceLocation L, DeclarationName N) - : Decl(DK, L), Name(N) {} + NamedDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N) + : Decl(DK, DC, L), Name(N) {} -public: - NamedDecl(Kind DK, SourceLocation L, IdentifierInfo *Id) - : Decl(DK, L), Name(Id) {} + NamedDecl(Kind DK, DeclContext *DC, SourceLocation L, IdentifierInfo *Id) + : Decl(DK, DC, L), Name(Id) {} +public: /// getIdentifier - Get the identifier that names this declaration, /// if there is one. This will return NULL if this declaration has /// no name (e.g., for an unnamed class) or if the name is a special @@ -98,126 +99,6 @@ public: /// For simple declarations, getNameAsCString() should suffice. std::string getNameAsString() const { return Name.getAsString(); } - static bool classof(const Decl *D) { - return D->getKind() >= NamedFirst && D->getKind() <= NamedLast; - } - static bool classof(const NamedDecl *D) { return true; } - -protected: - void EmitInRec(llvm::Serializer& S) const; - void ReadInRec(llvm::Deserializer& D, ASTContext& C); -}; - -/// ScopedDecl - Represent lexically scoped names, used for all ValueDecl's -/// and TypeDecl's. -class ScopedDecl : public NamedDecl { - /// NextDeclarator - If this decl was part of a multi-declarator declaration, - /// such as "int X, Y, *Z;" this indicates Decl for the next declarator. - ScopedDecl *NextDeclarator; - - /// NextDeclInScope - The next declaration within the same lexical - /// DeclContext. These pointers form the linked list that is - /// traversed via DeclContext's decls_begin()/decls_end(). - /// FIXME: If NextDeclarator is non-NULL, will it always be the same - /// as NextDeclInScope? If so, we can use a - /// PointerIntPair<ScopedDecl*, 1> to make ScopedDecl smaller. - ScopedDecl *NextDeclInScope; - - friend class DeclContext; - friend class DeclContext::decl_iterator; - - /// DeclCtx - Holds either a DeclContext* or a MultipleDC*. - /// For declarations that don't contain C++ scope specifiers, it contains - /// the DeclContext where the ScopedDecl was declared. - /// For declarations with C++ scope specifiers, it contains a MultipleDC* - /// with the context where it semantically belongs (SemanticDC) and the - /// context where it was lexically declared (LexicalDC). - /// e.g.: - /// - /// namespace A { - /// void f(); // SemanticDC == LexicalDC == 'namespace A' - /// } - /// void A::f(); // SemanticDC == namespace 'A' - /// // LexicalDC == global namespace - uintptr_t DeclCtx; - - struct MultipleDC { - DeclContext *SemanticDC; - DeclContext *LexicalDC; - }; - - inline bool isInSemaDC() const { return (DeclCtx & 0x1) == 0; } - inline bool isOutOfSemaDC() const { return (DeclCtx & 0x1) != 0; } - inline MultipleDC *getMultipleDC() const { - return reinterpret_cast<MultipleDC*>(DeclCtx & ~0x1); - } - -protected: - ScopedDecl(Kind DK, DeclContext *DC, SourceLocation L, - DeclarationName N, ScopedDecl *PrevDecl = 0) - : NamedDecl(DK, L, N), NextDeclarator(PrevDecl), NextDeclInScope(0), - DeclCtx(reinterpret_cast<uintptr_t>(DC)) {} - - virtual ~ScopedDecl(); - - /// setDeclContext - Set both the semantic and lexical DeclContext - /// to DC. - void setDeclContext(DeclContext *DC); - -public: - const DeclContext *getDeclContext() const { - if (isInSemaDC()) - return reinterpret_cast<DeclContext*>(DeclCtx); - return getMultipleDC()->SemanticDC; - } - DeclContext *getDeclContext() { - return const_cast<DeclContext*>( - const_cast<const ScopedDecl*>(this)->getDeclContext()); - } - - void setAccess(AccessSpecifier AS) { Access = AS; } - AccessSpecifier getAccess() const { return AccessSpecifier(Access); } - - /// getLexicalDeclContext - The declaration context where this ScopedDecl was - /// lexically declared (LexicalDC). May be different from - /// getDeclContext() (SemanticDC). - /// e.g.: - /// - /// namespace A { - /// void f(); // SemanticDC == LexicalDC == 'namespace A' - /// } - /// void A::f(); // SemanticDC == namespace 'A' - /// // LexicalDC == global namespace - const DeclContext *getLexicalDeclContext() const { - if (isInSemaDC()) - return reinterpret_cast<DeclContext*>(DeclCtx); - return getMultipleDC()->LexicalDC; - } - DeclContext *getLexicalDeclContext() { - return const_cast<DeclContext*>( - const_cast<const ScopedDecl*>(this)->getLexicalDeclContext()); - } - - void setLexicalDeclContext(DeclContext *DC); - - /// getNextDeclarator - If this decl was part of a multi-declarator - /// declaration, such as "int X, Y, *Z;" this returns the decl for the next - /// declarator. Otherwise it returns null. - ScopedDecl *getNextDeclarator() { return NextDeclarator; } - const ScopedDecl *getNextDeclarator() const { return NextDeclarator; } - void setNextDeclarator(ScopedDecl *N) { NextDeclarator = N; } - - // isDefinedOutsideFunctionOrMethod - This predicate returns true if this - // scoped decl is defined outside the current function or method. This is - // roughly global variables and functions, but also handles enums (which could - // be defined inside or outside a function etc). - bool isDefinedOutsideFunctionOrMethod() const { - if (getDeclContext()) - return !getDeclContext()->getLookupContext()->isFunctionOrMethod(); - else - return true; - } - /// declarationReplaces - Determine whether this declaration, if /// known to be well-formed within its context, will replace the /// declaration OldD if introduced into scope. A declaration will @@ -227,24 +108,18 @@ public: /// overloaded function. bool declarationReplaces(NamedDecl *OldD) const; - // Implement isa/cast/dyncast/etc. static bool classof(const Decl *D) { - return D->getKind() >= ScopedFirst && D->getKind() <= ScopedLast; + return D->getKind() >= NamedFirst && D->getKind() <= NamedLast; } - static bool classof(const ScopedDecl *D) { return true; } + static bool classof(const NamedDecl *D) { return true; } protected: void EmitInRec(llvm::Serializer& S) const; void ReadInRec(llvm::Deserializer& D, ASTContext& C); - - void EmitOutRec(llvm::Serializer& S) const; - void ReadOutRec(llvm::Deserializer& D, ASTContext& C); - - friend void Decl::Destroy(ASTContext& C); }; /// NamespaceDecl - Represent a C++ namespace. -class NamespaceDecl : public ScopedDecl, public DeclContext { +class NamespaceDecl : public NamedDecl, public DeclContext { SourceLocation LBracLoc, RBracLoc; // For extended namespace definitions: @@ -260,7 +135,7 @@ class NamespaceDecl : public ScopedDecl, public DeclContext { NamespaceDecl *OrigNamespace; NamespaceDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id) - : ScopedDecl(Namespace, DC, L, Id, 0), DeclContext(Namespace) { + : NamedDecl(Namespace, DC, L, Id), DeclContext(Namespace) { OrigNamespace = this; } public: @@ -314,13 +189,13 @@ protected: /// ValueDecl - Represent the declaration of a variable (in which case it is /// an lvalue) a function (in which case it is a function designator) or /// an enum constant. -class ValueDecl : public ScopedDecl { +class ValueDecl : public NamedDecl { QualType DeclType; protected: ValueDecl(Kind DK, DeclContext *DC, SourceLocation L, - DeclarationName N, QualType T, ScopedDecl *PrevDecl) - : ScopedDecl(DK, DC, L, N, PrevDecl), DeclType(T) {} + DeclarationName N, QualType T) + : NamedDecl(DK, DC, L, N), DeclType(T) {} public: QualType getType() const { return DeclType; } void setType(QualType newType) { DeclType = newType; } @@ -359,9 +234,8 @@ private: friend class StmtIteratorBase; protected: VarDecl(Kind DK, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, - QualType T, StorageClass SC, ScopedDecl *PrevDecl, - SourceLocation TSSL = SourceLocation()) - : ValueDecl(DK, DC, L, Id, T, PrevDecl), Init(0), + QualType T, StorageClass SC, SourceLocation TSSL = SourceLocation()) + : ValueDecl(DK, DC, L, Id, T), Init(0), ThreadSpecified(false), HasCXXDirectInit(false), DeclaredInCondition(false), TypeSpecStartLoc(TSSL) { SClass = SC; @@ -369,7 +243,7 @@ protected: public: static VarDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, - QualType T, StorageClass S, ScopedDecl *PrevDecl, + QualType T, StorageClass S, SourceLocation TypeSpecStartLoc = SourceLocation()); virtual ~VarDecl(); @@ -480,12 +354,12 @@ protected: class ImplicitParamDecl : public VarDecl { protected: ImplicitParamDecl(Kind DK, DeclContext *DC, SourceLocation L, - IdentifierInfo *Id, QualType T, ScopedDecl *PrevDecl) - : VarDecl(DK, DC, L, Id, T, VarDecl::None, PrevDecl) {} + IdentifierInfo *Id, QualType Tw) + : VarDecl(DK, DC, L, Id, Tw, VarDecl::None) {} public: static ImplicitParamDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, - QualType T, ScopedDecl *PrevDecl); + QualType T); // Implement isa/cast/dyncast/etc. static bool classof(const ImplicitParamDecl *D) { return true; } static bool classof(const Decl *D) { return D->getKind() == ImplicitParam; } @@ -503,15 +377,14 @@ class ParmVarDecl : public VarDecl { protected: ParmVarDecl(Kind DK, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, QualType T, StorageClass S, - Expr *DefArg, ScopedDecl *PrevDecl) - : VarDecl(DK, DC, L, Id, T, S, PrevDecl), + Expr *DefArg) + : VarDecl(DK, DC, L, Id, T, S), objcDeclQualifier(OBJC_TQ_None), DefaultArg(DefArg) {} public: static ParmVarDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L,IdentifierInfo *Id, - QualType T, StorageClass S, Expr *DefArg, - ScopedDecl *PrevDecl); + QualType T, StorageClass S, Expr *DefArg); ObjCDeclQualifier getObjCDeclQualifier() const { return ObjCDeclQualifier(objcDeclQualifier); @@ -582,15 +455,13 @@ private: ParmVarWithOriginalTypeDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id, QualType T, QualType OT, StorageClass S, - Expr *DefArg, ScopedDecl *PrevDecl) - : ParmVarDecl(OriginalParmVar, - DC, L, Id, T, S, DefArg, PrevDecl), OriginalType(OT) {} + Expr *DefArg) + : ParmVarDecl(OriginalParmVar, DC, L, Id, T, S, DefArg), OriginalType(OT) {} public: static ParmVarWithOriginalTypeDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L,IdentifierInfo *Id, QualType T, QualType OT, - StorageClass S, Expr *DefArg, - ScopedDecl *PrevDecl); |