From: John McCall Date: Mon, 7 Dec 2009 02:54:59 +0000 (+0000) Subject: DeclaratorInfo -> TypeSourceInfo. Makes an effort to rename associated variables, X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a93c934af4fbf97cbe8e649d82e68ccacfe57c95;p=clang DeclaratorInfo -> TypeSourceInfo. Makes an effort to rename associated variables, but the results are imperfect. For posterity, I did: cat < $cmdfile s/DeclaratorInfo/TypeSourceInfo/g s/DInfo/TInfo/g s/TypeTypeSourceInfo/TypeSourceInfo/g s/SourceTypeSourceInfo/TypeSourceInfo/g EOF find lib -name '*.cpp' -not -path 'lib/Parse/*' -exec sed -i '' -f $cmdfile '{}' \; find lib -name '*.h' -exec sed -i '' -f $cmdfile '{}' \; find include -name '*.h' -not -path 'include/clang/Parse/*' -not -path 'include/clang/Basic/*' -exec sed -i '' -f $cmdfile '{}' \; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90743 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index 78ead42007..1e32a25a2c 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -1117,9 +1117,9 @@ public: void setObjCImplementation(ObjCCategoryDecl *CatD, ObjCCategoryImplDecl *ImplD); - /// \brief Allocate an uninitialized DeclaratorInfo. + /// \brief Allocate an uninitialized TypeSourceInfo. /// - /// The caller should initialize the memory held by DeclaratorInfo using + /// The caller should initialize the memory held by TypeSourceInfo using /// the TypeLoc wrappers. /// /// \param T the type that will be the basis for type source info. This type @@ -1128,13 +1128,13 @@ public: /// /// \param Size the size of the type info to create, or 0 if the size /// should be calculated based on the type. - DeclaratorInfo *CreateDeclaratorInfo(QualType T, unsigned Size = 0); + TypeSourceInfo *CreateTypeSourceInfo(QualType T, unsigned Size = 0); - /// \brief Allocate a DeclaratorInfo where all locations have been + /// \brief Allocate a TypeSourceInfo where all locations have been /// initialized to a given location, which defaults to the empty /// location. - DeclaratorInfo * - getTrivialDeclaratorInfo(QualType T, SourceLocation Loc = SourceLocation()); + TypeSourceInfo * + getTrivialTypeSourceInfo(QualType T, SourceLocation Loc = SourceLocation()); private: ASTContext(const ASTContext&); // DO NOT IMPLEMENT diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 647ad03f40..7384a84ff1 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -35,17 +35,17 @@ class TypeLoc; /// /// A client can read the relevant info using TypeLoc wrappers, e.g: /// @code -/// TypeLoc TL = DeclaratorInfo->getTypeLoc(); +/// TypeLoc TL = TypeSourceInfo->getTypeLoc(); /// if (PointerLoc *PL = dyn_cast(&TL)) /// PL->getStarLoc().print(OS, SrcMgr); /// @endcode /// -class DeclaratorInfo { +class TypeSourceInfo { QualType Ty; // Contains a memory block after the class, used for type source information, // allocated by ASTContext. friend class ASTContext; - DeclaratorInfo(QualType ty) : Ty(ty) { } + TypeSourceInfo(QualType ty) : Ty(ty) { } public: /// \brief Return the type wrapped by this type source info. QualType getType() const { return Ty; } @@ -322,18 +322,18 @@ public: }; /// \brief Represents a ValueDecl that came out of a declarator. -/// Contains type source information through DeclaratorInfo. +/// Contains type source information through TypeSourceInfo. class DeclaratorDecl : public ValueDecl { - DeclaratorInfo *DeclInfo; + TypeSourceInfo *DeclInfo; protected: DeclaratorDecl(Kind DK, DeclContext *DC, SourceLocation L, - DeclarationName N, QualType T, DeclaratorInfo *DInfo) - : ValueDecl(DK, DC, L, N, T), DeclInfo(DInfo) {} + DeclarationName N, QualType T, TypeSourceInfo *TInfo) + : ValueDecl(DK, DC, L, N, T), DeclInfo(TInfo) {} public: - DeclaratorInfo *getDeclaratorInfo() const { return DeclInfo; } - void setDeclaratorInfo(DeclaratorInfo *DInfo) { DeclInfo = DInfo; } + TypeSourceInfo *getTypeSourceInfo() const { return DeclInfo; } + void setTypeSourceInfo(TypeSourceInfo *TInfo) { DeclInfo = TInfo; } SourceLocation getTypeSpecStartLoc() const; @@ -440,8 +440,8 @@ private: friend class StmtIteratorBase; protected: VarDecl(Kind DK, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, - QualType T, DeclaratorInfo *DInfo, StorageClass SC) - : DeclaratorDecl(DK, DC, L, Id, T, DInfo), Init(), + QualType T, TypeSourceInfo *TInfo, StorageClass SC) + : DeclaratorDecl(DK, DC, L, Id, T, TInfo), Init(), ThreadSpecified(false), HasCXXDirectInit(false), DeclaredInCondition(false) { SClass = SC; @@ -461,7 +461,7 @@ public: static VarDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, - QualType T, DeclaratorInfo *DInfo, StorageClass S); + QualType T, TypeSourceInfo *TInfo, StorageClass S); virtual ~VarDecl(); virtual void Destroy(ASTContext& C); @@ -752,7 +752,7 @@ class ImplicitParamDecl : public VarDecl { protected: ImplicitParamDecl(Kind DK, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, QualType Tw) - : VarDecl(DK, DC, L, Id, Tw, /*DInfo=*/0, VarDecl::None) {} + : VarDecl(DK, DC, L, Id, Tw, /*TInfo=*/0, VarDecl::None) {} public: static ImplicitParamDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, @@ -779,16 +779,16 @@ class ParmVarDecl : public VarDecl { protected: ParmVarDecl(Kind DK, DeclContext *DC, SourceLocation L, - IdentifierInfo *Id, QualType T, DeclaratorInfo *DInfo, + IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg) - : VarDecl(DK, DC, L, Id, T, DInfo, S), objcDeclQualifier(OBJC_TQ_None) { + : VarDecl(DK, DC, L, Id, T, TInfo, S), objcDeclQualifier(OBJC_TQ_None) { setDefaultArg(DefArg); } public: static ParmVarDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L,IdentifierInfo *Id, - QualType T, DeclaratorInfo *DInfo, + QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg); ObjCDeclQualifier getObjCDeclQualifier() const { @@ -862,8 +862,8 @@ public: } QualType getOriginalType() const { - if (getDeclaratorInfo()) - return getDeclaratorInfo()->getType(); + if (getTypeSourceInfo()) + return getTypeSourceInfo()->getType(); return getType(); } @@ -947,9 +947,9 @@ private: protected: FunctionDecl(Kind DK, DeclContext *DC, SourceLocation L, - DeclarationName N, QualType T, DeclaratorInfo *DInfo, + DeclarationName N, QualType T, TypeSourceInfo *TInfo, StorageClass S, bool isInline) - : DeclaratorDecl(DK, DC, L, N, T, DInfo), + : DeclaratorDecl(DK, DC, L, N, T, TInfo), DeclContext(DK), ParamInfo(0), Body(), SClass(S), IsInline(isInline), @@ -976,7 +976,7 @@ public: static FunctionDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T, - DeclaratorInfo *DInfo, + TypeSourceInfo *TInfo, StorageClass S = None, bool isInline = false, bool hasWrittenPrototype = true); @@ -1312,15 +1312,15 @@ class FieldDecl : public DeclaratorDecl { Expr *BitWidth; protected: FieldDecl(Kind DK, DeclContext *DC, SourceLocation L, - IdentifierInfo *Id, QualType T, DeclaratorInfo *DInfo, + IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable) - : DeclaratorDecl(DK, DC, L, Id, T, DInfo), Mutable(Mutable), BitWidth(BW) { + : DeclaratorDecl(DK, DC, L, Id, T, TInfo), Mutable(Mutable), BitWidth(BW) { } public: static FieldDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, QualType T, - DeclaratorInfo *DInfo, Expr *BW, bool Mutable); + TypeSourceInfo *TInfo, Expr *BW, bool Mutable); /// isMutable - Determines whether this field is mutable (C++ only). bool isMutable() const { return Mutable; } @@ -1423,28 +1423,28 @@ public: class TypedefDecl : public TypeDecl { /// UnderlyingType - This is the type the typedef is set to. - DeclaratorInfo *DInfo; + TypeSourceInfo *TInfo; TypedefDecl(DeclContext *DC, SourceLocation L, - IdentifierInfo *Id, DeclaratorInfo *DInfo) - : TypeDecl(Typedef, DC, L, Id), DInfo(DInfo) {} + IdentifierInfo *Id, TypeSourceInfo *TInfo) + : TypeDecl(Typedef, DC, L, Id), TInfo(TInfo) {} virtual ~TypedefDecl() {} public: static TypedefDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, - DeclaratorInfo *DInfo); + TypeSourceInfo *TInfo); - DeclaratorInfo *getTypeDeclaratorInfo() const { - return DInfo; + TypeSourceInfo *getTypeSourceInfo() const { + return TInfo; } QualType getUnderlyingType() const { - return DInfo->getType(); + return TInfo->getType(); } - void setTypeDeclaratorInfo(DeclaratorInfo *newType) { - DInfo = newType; + void setTypeSourceInfo(TypeSourceInfo *newType) { + TInfo = newType; } // Implement isa/cast/dyncast/etc. diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h index 083284c908..417f71814d 100644 --- a/include/clang/AST/DeclCXX.h +++ b/include/clang/AST/DeclCXX.h @@ -804,15 +804,15 @@ public: class CXXMethodDecl : public FunctionDecl { protected: CXXMethodDecl(Kind DK, CXXRecordDecl *RD, SourceLocation L, - DeclarationName N, QualType T, DeclaratorInfo *DInfo, + DeclarationName N, QualType T, TypeSourceInfo *TInfo, bool isStatic, bool isInline) - : FunctionDecl(DK, RD, L, N, T, DInfo, (isStatic ? Static : None), + : FunctionDecl(DK, RD, L, N, T, TInfo, (isStatic ? Static : None), isInline) {} public: static CXXMethodDecl *Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation L, DeclarationName N, - QualType T, DeclaratorInfo *DInfo, + QualType T, TypeSourceInfo *TInfo, bool isStatic = false, bool isInline = false); @@ -894,9 +894,9 @@ public: /// }; /// @endcode class CXXBaseOrMemberInitializer { - /// \brief Either the base class name (stored as a DeclaratorInfo*) or the + /// \brief Either the base class name (stored as a TypeSourceInfo*) or the /// field being initialized. - llvm::PointerUnion BaseOrMember; + llvm::PointerUnion BaseOrMember; /// \brief The source location for the field name. SourceLocation MemberLocation; @@ -935,7 +935,7 @@ public: /// CXXBaseOrMemberInitializer - Creates a new base-class initializer. explicit CXXBaseOrMemberInitializer(ASTContext &Context, - DeclaratorInfo *DInfo, CXXConstructorDecl *C, + TypeSourceInfo *TInfo, CXXConstructorDecl *C, SourceLocation L, Expr **Args, unsigned NumArgs, SourceLocation R); @@ -961,7 +961,7 @@ public: /// isBaseInitializer - Returns true when this initializer is /// initializing a base class. - bool isBaseInitializer() const { return BaseOrMember.is(); } + bool isBaseInitializer() const { return BaseOrMember.is(); } /// isMemberInitializer - Returns true when this initializer is /// initializing a non-static data member. @@ -978,8 +978,8 @@ public: Type *getBaseClass(); /// \brief Returns the declarator information for a base class initializer. - DeclaratorInfo *getBaseClassInfo() const { - return BaseOrMember.dyn_cast(); + TypeSourceInfo *getBaseClassInfo() const { + return BaseOrMember.dyn_cast(); } /// getMember - If this is a member initializer, returns the @@ -1064,9 +1064,9 @@ class CXXConstructorDecl : public CXXMethodDecl { unsigned NumBaseOrMemberInitializers; CXXConstructorDecl(CXXRecordDecl *RD, SourceLocation L, - DeclarationName N, QualType T, DeclaratorInfo *DInfo, + DeclarationName N, QualType T, TypeSourceInfo *TInfo, bool isExplicit, bool isInline, bool isImplicitlyDeclared) - : CXXMethodDecl(CXXConstructor, RD, L, N, T, DInfo, false, isInline), + : CXXMethodDecl(CXXConstructor, RD, L, N, T, TInfo, false, isInline), Explicit(isExplicit), ImplicitlyDefined(false), BaseOrMemberInitializers(0), NumBaseOrMemberInitializers(0) { setImplicit(isImplicitlyDeclared); @@ -1076,7 +1076,7 @@ class CXXConstructorDecl : public CXXMethodDecl { public: static CXXConstructorDecl *Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation L, DeclarationName N, - QualType T, DeclaratorInfo *DInfo, + QualType T, TypeSourceInfo *TInfo, bool isExplicit, bool isInline, bool isImplicitlyDeclared); @@ -1203,7 +1203,7 @@ class CXXDestructorDecl : public CXXMethodDecl { CXXDestructorDecl(CXXRecordDecl *RD, SourceLocation L, DeclarationName N, QualType T, bool isInline, bool isImplicitlyDeclared) - : CXXMethodDecl(CXXDestructor, RD, L, N, T, /*DInfo=*/0, false, isInline), + : CXXMethodDecl(CXXDestructor, RD, L, N, T, /*TInfo=*/0, false, isInline), ImplicitlyDefined(false), OperatorDelete(0) { setImplicit(isImplicitlyDeclared); } @@ -1258,15 +1258,15 @@ class CXXConversionDecl : public CXXMethodDecl { bool Explicit : 1; CXXConversionDecl(CXXRecordDecl *RD, SourceLocation L, - DeclarationName N, QualType T, DeclaratorInfo *DInfo, + DeclarationName N, QualType T, TypeSourceInfo *TInfo, bool isInline, bool isExplicit) - : CXXMethodDecl(CXXConversion, RD, L, N, T, DInfo, false, isInline), + : CXXMethodDecl(CXXConversion, RD, L, N, T, TInfo, false, isInline), Explicit(isExplicit) { } public: static CXXConversionDecl *Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation L, DeclarationName N, - QualType T, DeclaratorInfo *DInfo, + QualType T, TypeSourceInfo *TInfo, bool isInline, bool isExplicit); /// isExplicit - Whether this is an explicit conversion operator diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h index 897776cdb9..fd8c3ef7fc 100644 --- a/include/clang/AST/DeclObjC.h +++ b/include/clang/AST/DeclObjC.h @@ -578,14 +578,14 @@ public: private: ObjCIvarDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id, - QualType T, DeclaratorInfo *DInfo, AccessControl ac, Expr *BW) - : FieldDecl(ObjCIvar, DC, L, Id, T, DInfo, BW, /*Mutable=*/false), + QualType T, TypeSourceInfo *TInfo, AccessControl ac, Expr *BW) + : FieldDecl(ObjCIvar, DC, L, Id, T, TInfo, BW, /*Mutable=*/false), DeclAccess(ac) {} public: static ObjCIvarDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, QualType T, - DeclaratorInfo *DInfo, + TypeSourceInfo *TInfo, AccessControl ac, Expr *BW = NULL); void setAccessControl(AccessControl ac) { DeclAccess = ac; } @@ -612,7 +612,7 @@ private: ObjCAtDefsFieldDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id, QualType T, Expr *BW) : FieldDecl(ObjCAtDefsField, DC, L, Id, T, - /*DInfo=*/0, // FIXME: Do ObjCAtDefs have declarators ? + /*TInfo=*/0, // FIXME: Do ObjCAtDefs have declarators ? BW, /*Mutable=*/false) {} public: diff --git a/include/clang/AST/DeclTemplate.h b/include/clang/AST/DeclTemplate.h index 3ecc4bb52b..d8b004a049 100644 --- a/include/clang/AST/DeclTemplate.h +++ b/include/clang/AST/DeclTemplate.h @@ -573,7 +573,7 @@ class TemplateTypeParmDecl : public TypeDecl { bool ParameterPack : 1; /// \brief The default template argument, if any. - DeclaratorInfo *DefaultArgument; + TypeSourceInfo *DefaultArgument; TemplateTypeParmDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id, bool Typename, QualType Type, bool ParameterPack) @@ -601,7 +601,7 @@ public: QualType getDefaultArgument() const { return DefaultArgument->getType(); } /// \brief Retrieves the default argument's source information, if any. - DeclaratorInfo *getDefaultArgumentInfo() const { return DefaultArgument; } + TypeSourceInfo *getDefaultArgumentInfo() const { return DefaultArgument; } /// \brief Retrieves the location of the default argument declaration. SourceLocation getDefaultArgumentLoc() const; @@ -613,7 +613,7 @@ public: /// \brief Set the default argument for this template parameter, and /// whether that default argument was inherited from another /// declaration. - void setDefaultArgument(DeclaratorInfo *DefArg, bool Inherited) { + void setDefaultArgument(TypeSourceInfo *DefArg, bool Inherited) { DefaultArgument = DefArg; InheritedDefault = Inherited; } @@ -652,15 +652,15 @@ class NonTypeTemplateParmDecl NonTypeTemplateParmDecl(DeclContext *DC, SourceLocation L, unsigned D, unsigned P, IdentifierInfo *Id, QualType T, - DeclaratorInfo *DInfo) - : VarDecl(NonTypeTemplateParm, DC, L, Id, T, DInfo, VarDecl::None), + TypeSourceInfo *TInfo) + : VarDecl(NonTypeTemplateParm, DC, L, Id, T, TInfo, VarDecl::None), TemplateParmPosition(D, P), DefaultArgument(0) { } public: static NonTypeTemplateParmDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, - unsigned P, IdentifierInfo *Id, QualType T, DeclaratorInfo *DInfo); + unsigned P, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo); using TemplateParmPosition::getDepth; using TemplateParmPosition::getPosition; diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h index 220ae137c7..2b8e221e87 100644 --- a/include/clang/AST/Expr.h +++ b/include/clang/AST/Expr.h @@ -970,7 +970,7 @@ class SizeOfAlignOfExpr : public Expr { bool isSizeof : 1; // true if sizeof, false if alignof. bool isType : 1; // true if operand is a type, false if an expression union { - DeclaratorInfo *Ty; + TypeSourceInfo *Ty; Stmt *Ex; } Argument; SourceLocation OpLoc, RParenLoc; @@ -979,15 +979,15 @@ protected: virtual void DoDestroy(ASTContext& C); public: - SizeOfAlignOfExpr(bool issizeof, DeclaratorInfo *DInfo, + SizeOfAlignOfExpr(bool issizeof, TypeSourceInfo *TInfo, QualType resultType, SourceLocation op, SourceLocation rp) : Expr(SizeOfAlignOfExprClass, resultType, false, // Never type-dependent (C++ [temp.dep.expr]p3). // Value-dependent if the argument is type-dependent. - DInfo->getType()->isDependentType()), + TInfo->getType()->isDependentType()), isSizeof(issizeof), isType(true), OpLoc(op), RParenLoc(rp) { - Argument.Ty = DInfo; + Argument.Ty = TInfo; } SizeOfAlignOfExpr(bool issizeof, Expr *E, @@ -1012,7 +1012,7 @@ public: QualType getArgumentType() const { return getArgumentTypeInfo()->getType(); } - DeclaratorInfo *getArgumentTypeInfo() const { + TypeSourceInfo *getArgumentTypeInfo() const { assert(isArgumentType() && "calling getArgumentType() when arg is expr"); return Argument.Ty; } @@ -1025,8 +1025,8 @@ public: } void setArgument(Expr *E) { Argument.Ex = E; isType = false; } - void setArgument(DeclaratorInfo *DInfo) { - Argument.Ty = DInfo; + void setArgument(TypeSourceInfo *TInfo) { + Argument.Ty = TInfo; isType = true; } diff --git a/include/clang/AST/TemplateBase.h b/include/clang/AST/TemplateBase.h index b46b3dc5d2..ee01d6695d 100644 --- a/include/clang/AST/TemplateBase.h +++ b/include/clang/AST/TemplateBase.h @@ -29,7 +29,7 @@ namespace clang { class Decl; class Expr; -class DeclaratorInfo; +class TypeSourceInfo; /// \brief Represents a template argument within a class template /// specialization. @@ -267,7 +267,7 @@ struct TemplateArgumentLocInfo { private: union { Expr *Expression; - DeclaratorInfo *Declarator; + TypeSourceInfo *Declarator; struct { unsigned QualifierRange[2]; unsigned TemplateNameLoc; @@ -277,7 +277,7 @@ private: #ifndef NDEBUG enum Kind { K_None, - K_DeclaratorInfo, + K_TypeSourceInfo, K_Expression, K_Template } Kind; @@ -291,10 +291,10 @@ public: #endif {} - TemplateArgumentLocInfo(DeclaratorInfo *DInfo) - : Declarator(DInfo) + TemplateArgumentLocInfo(TypeSourceInfo *TInfo) + : Declarator(TInfo) #ifndef NDEBUG - , Kind(K_DeclaratorInfo) + , Kind(K_TypeSourceInfo) #endif {} @@ -316,8 +316,8 @@ public: Template.TemplateNameLoc = TemplateNameLoc.getRawEncoding(); } - DeclaratorInfo *getAsDeclaratorInfo() const { - assert(Kind == K_DeclaratorInfo); + TypeSourceInfo *getAsTypeSourceInfo() const { + assert(Kind == K_TypeSourceInfo); return Declarator; } @@ -342,7 +342,7 @@ public: void validateForArgument(const TemplateArgument &Arg) { switch (Arg.getKind()) { case TemplateArgument::Type: - assert(Kind == K_DeclaratorInfo); + assert(Kind == K_TypeSourceInfo); break; case TemplateArgument::Expression: case TemplateArgument::Declaration: @@ -376,8 +376,8 @@ public: : Argument(Argument), LocInfo(Opaque) { } - TemplateArgumentLoc(const TemplateArgument &Argument, DeclaratorInfo *DInfo) - : Argument(Argument), LocInfo(DInfo) { + TemplateArgumentLoc(const TemplateArgument &Argument, TypeSourceInfo *TInfo) + : Argument(Argument), LocInfo(TInfo) { assert(Argument.getKind() == TemplateArgument::Type); } @@ -412,9 +412,9 @@ public: return LocInfo; } - DeclaratorInfo *getSourceDeclaratorInfo() const { + TypeSourceInfo *getTypeSourceInfo() const { assert(Argument.getKind() == TemplateArgument::Type); - return LocInfo.getAsDeclaratorInfo(); + return LocInfo.getAsTypeSourceInfo(); } Expr *getSourceExpression() const { diff --git a/include/clang/AST/TypeLoc.h b/include/clang/AST/TypeLoc.h index 47274450b1..a9b7f7e943 100644 --- a/include/clang/AST/TypeLoc.h +++ b/include/clang/AST/TypeLoc.h @@ -19,7 +19,7 @@ namespace clang { class ParmVarDecl; - class DeclaratorInfo; + class TypeSourceInfo; class UnqualTypeLoc; // Predeclare all the type nodes. @@ -941,7 +941,7 @@ public: assert(size == Loc.getFullDataSize()); // We're potentially copying Expr references here. We don't - // bother retaining them because DeclaratorInfos live forever, so + // bother retaining them because TypeSourceInfos live forever, so // as long as the Expr was retained when originally written into // the TypeLoc, we're okay. memcpy(Data, Loc.Data, size); @@ -968,7 +968,7 @@ public: break; case TemplateArgument::Type: - Info = TemplateArgumentLocInfo((DeclaratorInfo*) 0); + Info = TemplateArgumentLocInfo((TypeSourceInfo*) 0); break; case TemplateArgument::Template: @@ -1043,7 +1043,7 @@ class TypeOfExprTypeLoc : public InheritingConcreteTypeLoc { }; -// FIXME: location of the 'typeof' and parens; also the DeclaratorInfo +// FIXME: location of the 'typeof' and parens; also the TypeSourceInfo // for the inner type, or (maybe) just express that inline to the TypeLoc. class TypeOfTypeLoc : public InheritingConcreteTypeLoc(pushImpl(T, LocalSize)); } - /// Creates a DeclaratorInfo for the given type. - DeclaratorInfo *getDeclaratorInfo(ASTContext& Context, QualType T) { + /// Creates a TypeSourceInfo for the given type. + TypeSourceInfo *getTypeSourceInfo(ASTContext& Context, QualType T) { #ifndef NDEBUG assert(T == LastTy && "type doesn't match last type pushed!"); #endif size_t FullDataSize = Capacity - Index; - DeclaratorInfo *DI = Context.CreateDeclaratorInfo(T, FullDataSize); + TypeSourceInfo *DI = Context.CreateTypeSourceInfo(T, FullDataSize); memcpy(DI->getTypeLoc().getOpaqueData(), &Buffer[Index], FullDataSize); return DI; } diff --git a/include/clang/Frontend/PCHReader.h b/include/clang/Frontend/PCHReader.h index ff92cee7f5..7e2c65690f 100644 --- a/include/clang/Frontend/PCHReader.h +++ b/include/clang/Frontend/PCHReader.h @@ -553,7 +553,7 @@ public: const RecordData &Record, unsigned &Idx); /// \brief Reads a declarator info from the given record. - virtual DeclaratorInfo *GetDeclaratorInfo(const RecordData &Record, + virtual TypeSourceInfo *GetTypeSourceInfo(const RecordData &Record, unsigned &Idx); /// \brief Resolve a type ID into a type, potentially building a new diff --git a/include/clang/Frontend/PCHWriter.h b/include/clang/Frontend/PCHWriter.h index b520f4be1d..a4bc3ff5b0 100644 --- a/include/clang/Frontend/PCHWriter.h +++ b/include/clang/Frontend/PCHWriter.h @@ -274,7 +274,7 @@ public: void AddTypeRef(QualType T, RecordData &Record); /// \brief Emits a reference to a declarator info. - void AddDeclaratorInfo(DeclaratorInfo *DInfo, RecordData &Record); + void AddTypeSourceInfo(TypeSourceInfo *TInfo, RecordData &Record); /// \brief Emits a template argument location. void AddTemplateArgumentLoc(const TemplateArgumentLoc &Arg, diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index bce7d67edf..cc96a5dc0e 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -1009,31 +1009,31 @@ void ASTContext::setObjCImplementation(ObjCCategoryDecl *CatD, ObjCImpls[CatD] = ImplD; } -/// \brief Allocate an uninitialized DeclaratorInfo. +/// \brief Allocate an uninitialized TypeSourceInfo. /// -/// The caller should initialize the memory held by DeclaratorInfo using +/// The caller should initialize the memory held by TypeSourceInfo using /// the TypeLoc wrappers. /// /// \param T the type that will be the basis for type source info. This type /// should refer to how the declarator was written in source code, not to /// what type semantic analysis resolved the declarator to. -DeclaratorInfo *ASTContext::CreateDeclaratorInfo(QualType T, +TypeSourceInfo *ASTContext::CreateTypeSourceInfo(QualType T, unsigned DataSize) { if (!DataSize) DataSize = TypeLoc::getFullDataSizeForType(T); else assert(DataSize == TypeLoc::getFullDataSizeForType(T) && - "incorrect data size provided to CreateDeclaratorInfo!"); + "incorrect data size provided to CreateTypeSourceInfo!"); - DeclaratorInfo *DInfo = - (DeclaratorInfo*)BumpAlloc.Allocate(sizeof(DeclaratorInfo) + DataSize, 8); - new (DInfo) DeclaratorInfo(T); - return DInfo; + TypeSourceInfo *TInfo = + (TypeSourceInfo*)BumpAlloc.Allocate(sizeof(TypeSourceInfo) + DataSize, 8); + new (TInfo) TypeSourceInfo(T); + return TInfo; } -DeclaratorInfo *ASTContext::getTrivialDeclaratorInfo(QualType T, +TypeSourceInfo *ASTContext::getTrivialTypeSourceInfo(QualType T, SourceLocation L) { - DeclaratorInfo *DI = CreateDeclaratorInfo(T); + TypeSourceInfo *DI = CreateTypeSourceInfo(T); DI->getTypeLoc().initialize(L); return DI; } @@ -2808,7 +2808,7 @@ QualType ASTContext::getCFConstantStringType() { for (unsigned i = 0; i < 4; ++i) { FieldDecl *Field = FieldDecl::Create(*this, CFConstantStringTypeDecl, SourceLocation(), 0, - FieldTypes[i], /*DInfo=*/0, + FieldTypes[i], /*TInfo=*/0, /*BitWidth=*/0, /*Mutable=*/false); CFConstantStringTypeDecl->addDecl(Field); @@ -2844,7 +2844,7 @@ QualType ASTContext::getObjCFastEnumerationStateType() { FieldDecl *Field = FieldDecl::Create(*this, ObjCFastEnumerationStateTypeDecl, SourceLocation(), 0, - FieldTypes[i], /*DInfo=*/0, + FieldTypes[i], /*TInfo=*/0, /*BitWidth=*/0, /*Mutable=*/false); ObjCFastEnumerationStateTypeDecl->addDecl(Field); @@ -2880,7 +2880,7 @@ QualType ASTContext::getBlockDescriptorType() { T, SourceLocation(), &Idents.get(FieldNames[i]), - FieldTypes[i], /*DInfo=*/0, + FieldTypes[i], /*TInfo=*/0, /*BitWidth=*/0, /*Mutable=*/false); T->addDecl(Field); @@ -2927,7 +2927,7 @@ QualType ASTContext::getBlockDescriptorExtendedType() { T, SourceLocation(), &Idents.get(FieldNames[i]), - FieldTypes[i], /*DInfo=*/0, + FieldTypes[i], /*TInfo=*/0, /*BitWidth=*/0, /*Mutable=*/false); T->addDecl(Field); @@ -3005,7 +3005,7 @@ QualType ASTContext::BuildByRefType(const char *DeclName, QualType Ty) { continue; FieldDecl *Field = FieldDecl::Create(*this, T, SourceLocation(), &Idents.get(FieldNames[i]), - FieldTypes[i], /*DInfo=*/0, + FieldTypes[i], /*TInfo=*/0, /*BitWidth=*/0, /*Mutable=*/false); T->addDecl(Field); } @@ -3048,7 +3048,7 @@ QualType ASTContext::getBlockParmType( for (size_t i = 0; i < 5; ++i) { FieldDecl *Field = FieldDecl::Create(*this, T, SourceLocation(), &Idents.get(FieldNames[i]), - FieldTypes[i], /*DInfo=*/0, + FieldTypes[i], /*TInfo=*/0, /*BitWidth=*/0, /*Mutable=*/false); T->addDecl(Field); } @@ -3068,7 +3068,7 @@ QualType ASTContext::getBlockParmType( FieldType); FieldDecl *Field = FieldDecl::Create(*this, T, SourceLocation(), - Name, FieldType, /*DInfo=*/0, + Name, FieldType, /*TInfo=*/0, /*BitWidth=*/0, /*Mutable=*/false); T->addDecl(Field); } diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 51a4731bfc..42c9ef948c 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -38,7 +38,7 @@ void Attr::Destroy(ASTContext &C) { } /// \brief Return the TypeLoc wrapper for the type source info. -TypeLoc DeclaratorInfo::getTypeLoc() const { +TypeLoc TypeSourceInfo::getTypeLoc() const { return TypeLoc(Ty, (void*)(this + 1)); } @@ -86,9 +86,9 @@ const char *VarDecl::getStorageClassSpecifierString(StorageClass SC) { ParmVarDecl *ParmVarDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, - QualType T, DeclaratorInfo *DInfo, + QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg) { - return new (C) ParmVarDecl(ParmVar, DC, L, Id, T, DInfo, S, DefArg); + return new (C) ParmVarDecl(ParmVar, DC, L, Id, T, TInfo, S, DefArg); } SourceRange ParmVarDecl::getDefaultArgRange() const { @@ -136,11 +136,11 @@ bool VarDecl::isExternC() const { FunctionDecl *FunctionDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T, - DeclaratorInfo *DInfo, + TypeSourceInfo *TInfo, StorageClass S, bool isInline, bool hasWrittenPrototype) { FunctionDecl *New - = new (C) FunctionDecl(Function, DC, L, N, T, DInfo, S, isInline); + = new (C) FunctionDecl(Function, DC, L, N, T, TInfo, S, isInline); New->HasWrittenPrototype = hasWrittenPrototype; return New; } @@ -151,8 +151,8 @@ BlockDecl *BlockDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L) { FieldDecl *FieldDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, QualType T, - DeclaratorInfo *DInfo, Expr *BW, bool Mutable) { - return new (C) FieldDecl(Decl::Field, DC, L, Id, T, DInfo, BW, Mutable); + TypeSourceInfo *TInfo, Expr *BW, bool Mutable) { + return new (C) FieldDecl(Decl::Field, DC, L, Id, T, TInfo, BW, Mutable); } bool FieldDecl::isAnonymousStructOrUnion() const { @@ -179,8 +179,8 @@ void EnumConstantDecl::Destroy(ASTContext& C) { TypedefDecl *TypedefDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, - DeclaratorInfo *DInfo) { - return new (C) TypedefDecl(DC, L, Id, DInfo); + TypeSourceInfo *TInfo) { + return new (C) TypedefDecl(DC, L, Id, TInfo); } EnumDecl *EnumDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, @@ -535,9 +535,9 @@ SourceLocation DeclaratorDecl::getTypeSpecStartLoc() const { //===----------------------------------------------------------------------===// VarDecl *VarDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, - IdentifierInfo *Id, QualType T, DeclaratorInfo *DInfo, + IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S) { - return new (C) VarDecl(Var, DC, L, Id, T, DInfo, S); + return new (C) VarDecl(Var, DC, L, Id, T, TInfo, S); } void VarDecl::Destroy(ASTContext& C) { diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp index 766cb01814..4680b87cb2 100644 --- a/lib/AST/DeclCXX.cpp +++ b/lib/AST/DeclCXX.cpp @@ -540,9 +540,9 @@ CXXDestructorDecl *CXXRecordDecl::getDestructor(ASTContext &Context) { CXXMethodDecl * CXXMethodDecl::Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation L, DeclarationName N, - QualType T, DeclaratorInfo *DInfo, + QualType T, TypeSourceInfo *TInfo, bool isStatic, bool isInline) { - return new (C) CXXMethodDecl(CXXMethod, RD, L, N, T, DInfo, + return new (C) CXXMethodDecl(CXXMethod, RD, L, N, T, TInfo, isStatic, isInline); } @@ -665,11 +665,11 @@ bool CXXMethodDecl::hasInlineBody() const { CXXBaseOrMemberInitializer:: CXXBaseOrMemberInitializer(ASTContext &Context, - DeclaratorInfo *DInfo, CXXConstructorDecl *C, + TypeSourceInfo *TInfo, CXXConstructorDecl *C, SourceLocation L, Expr **Args, unsigned NumArgs, SourceLocation R) - : BaseOrMember(DInfo), Args(0), NumArgs(0), CtorOrAnonUnion(C), + : BaseOrMember(TInfo), Args(0), NumArgs(0), CtorOrAnonUnion(C), LParenLoc(L), RParenLoc(R) { if (NumArgs > 0) { @@ -706,21 +706,21 @@ void CXXBaseOrMemberInitializer::Destroy(ASTContext &Context) { TypeLoc CXXBaseOrMemberInitializer::getBaseClassLoc() const { if (isBaseInitializer()) - return BaseOrMember.get()->getTypeLoc(); + return BaseOrMember.get()->getTypeLoc(); else return TypeLoc(); } Type *CXXBaseOrMemberInitializer::getBaseClass() { if (isBaseInitializer()) - return BaseOrMember.get()->getType().getTypePtr(); + return BaseOrMember.get()->getType().getTypePtr(); else return 0; } const Type *CXXBaseOrMemberInitializer::getBaseClass() const { if (isBaseInitializer()) - return BaseOrMember.get()->getType().getTypePtr(); + return BaseOrMember.get()->getType().getTypePtr(); else return 0; } @@ -739,12 +739,12 @@ SourceRange CXXBaseOrMemberInitializer::getSourceRange() const { CXXConstructorDecl * CXXConstructorDecl::Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation L, DeclarationName N, - QualType T, DeclaratorInfo *DInfo, + QualType T, TypeSourceInfo *TInfo, bool isExplicit, bool isInline, bool isImplicitlyDeclared) { assert(N.getNameKind() == DeclarationName::CXXConstructorName && "Name must refer to a constructor"); - return new (C) CXXConstructorDecl(RD, L, N, T, DInfo, isExplicit, isInline, + return new (C) CXXConstructorDecl(RD, L, N, T, TInfo, isExplicit, isInline, isImplicitlyDeclared); } @@ -856,11 +856,11 @@ CXXConstructorDecl::Destroy(ASTContext& C) { CXXConversionDecl * CXXConversionDecl::Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation L, DeclarationName N, - QualType T, DeclaratorInfo *DInfo, + QualType T, TypeSourceInfo *TInfo, bool isInline, bool isExplicit) { assert(N.getNameKind() == DeclarationName::CXXConversionFunctionName && "Name must refer to a conversion function"); - return new (C) CXXConversionDecl(RD, L, N, T, DInfo, isInline, isExplicit); + return new (C) CXXConversionDecl(RD, L, N, T, TInfo, isInline, isExplicit); } FriendDecl *FriendDecl::Create(ASTContext &C, DeclContext *DC, diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp index c33720f563..2506f27e6f 100644 --- a/lib/AST/DeclObjC.cpp +++ b/lib/AST/DeclObjC.cpp @@ -501,9 +501,9 @@ bool ObjCInterfaceDecl::ClassImplementsProtocol(ObjCProtocolDecl *lProto, ObjCIvarDecl *ObjCIvarDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, - QualType T, DeclaratorInfo *DInfo, + QualType T, TypeSourceInfo *TInfo, AccessControl ac, Expr *BW) { - return new (C) ObjCIvarDecl(DC, L, Id, T, DInfo, ac, BW); + return new (C) ObjCIvarDecl(DC, L, Id, T, TInfo, ac, BW); } diff --git a/lib/AST/DeclTemplate.cpp b/lib/AST/DeclTemplate.cpp index 902339e1ef..75b3975322 100644 --- a/lib/AST/DeclTemplate.cpp +++ b/lib/AST/DeclTemplate.cpp @@ -262,8 +262,8 @@ NonTypeTemplateParmDecl * NonTypeTemplateParmDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, unsigned P, IdentifierInfo *Id, QualType T, - DeclaratorInfo *DInfo) { - return new (C) NonTypeTemplateParmDecl(DC, L, D, P, Id, T, DInfo); + TypeSourceInfo *TInfo) { + return new (C) NonTypeTemplateParmDecl(DC, L, D, P, Id, T, TInfo); } SourceLocation NonTypeTemplateParmDecl::getDefaultArgumentLoc() const { diff --git a/lib/AST/TemplateBase.cpp b/lib/AST/TemplateBase.cpp index f341b45fb9..e9b1725641 100644 --- a/lib/AST/TemplateBase.cpp +++ b/lib/AST/TemplateBase.cpp @@ -102,7 +102,7 @@ SourceRange TemplateArgumentLoc::getSourceRange() const { return getSourceDeclExpression()->getSourceRange(); case TemplateArgument::Type: - return getSourceDeclaratorInfo()->getTypeLoc().getFullSourceRange(); + return getTypeSourceInfo()->getTypeLoc().getFullSourceRange(); case TemplateArgument::Template: if (getTemplateQualifierRange().isValid()) diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp index 811f9ed4af..aae201400d 100644 --- a/lib/Frontend/PCHReader.cpp +++ b/lib/Frontend/PCHReader.cpp @@ -2113,17 +2113,17 @@ void TypeLocReader::VisitObjCObjectPointerTypeLoc(ObjCObjectPointerTypeLoc TL) { TL.setProtocolLoc(i, SourceLocation::getFromRawEncoding(Record[Idx++])); } -DeclaratorInfo *PCHReader::GetDeclaratorInfo(const RecordData &Record, +TypeSourceInfo *PCHReader::GetTypeSourceInfo(const RecordData &Record, unsigned &Idx) { QualType InfoTy = GetType(Record[Idx++]); if (InfoTy.isNull()) return 0; - DeclaratorInfo *DInfo = getContext()->CreateDeclaratorInfo(InfoTy); + TypeSourceInfo *TInfo = getContext()->CreateTypeSourceInfo(InfoTy); TypeLocReader TLR(*this, Record, Idx); - for (TypeLoc TL = DInfo->getTypeLoc(); !TL.isNull(); TL = TL.getNextTypeLoc()) + for (TypeLoc TL = TInfo->getTypeLoc(); !TL.isNull(); TL = TL.getNextTypeLoc()) TLR.Visit(TL); - return DInfo; + return TInfo; } QualType PCHReader::GetType(pch::TypeID ID) { @@ -2189,7 +2189,7 @@ PCHReader::GetTemplateArgumentLocInfo(TemplateArgument::ArgKind Kind, case TemplateArgument::Expression: return ReadDeclExpr(); case TemplateArgument::Type: - return GetDeclaratorInfo(Record, Index); + return GetTypeSourceInfo(Record, Index); case TemplateArgument::Template: { SourceLocation QualStart = SourceLocation::getFromRawEncoding(Record[Index++]), diff --git a/lib/Frontend/PCHReaderDecl.cpp b/lib/Frontend/PCHReaderDecl.cpp index 03f3b47679..40d48c53af 100644 --- a/lib/Frontend/PCHReaderDecl.cpp +++ b/lib/Frontend/PCHReaderDecl.cpp @@ -107,7 +107,7 @@ void PCHDeclReader::VisitTypedefDecl(TypedefDecl *TD) { // the type associated with the TypedefDecl. VisitNamedDecl(TD); uint64_t TypeData = Record[Idx++]; - TD->setTypeDeclaratorInfo(Reader.GetDeclaratorInfo(Record, Idx)); + TD->setTypeSourceInfo(Reader.GetTypeSourceInfo(Record, Idx)); TD->setTypeForDecl(Reader.GetType(TypeData).getTypePtr()); } @@ -150,9 +150,9 @@ void PCHDeclReader::VisitEnumConstantDecl(EnumConstantDecl *ECD) { void PCHDeclReader::VisitDeclaratorDecl(DeclaratorDecl *DD) { VisitValueDecl(DD); - DeclaratorInfo *DInfo = Reader.GetDeclaratorInfo(Record, Idx); - if (DInfo) - DD->setDeclaratorInfo(DInfo); + TypeSourceInfo *TInfo = Reader.GetTypeSourceInfo(Record, Idx); + if (TInfo) + DD->setTypeSourceInfo(TInfo); } void PCHDeclReader::VisitFunctionDecl(FunctionDecl *FD) { diff --git a/lib/Frontend/PCHReaderStmt.cpp b/lib/Frontend/PCHReaderStmt.cpp index 4a3510cb1c..b2fc644c6d 100644 --- a/lib/Frontend/PCHReaderStmt.cpp +++ b/lib/Frontend/PCHReaderStmt.cpp @@ -428,7 +428,7 @@ unsigned PCHStmtReader::VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) { E->setArgument(cast(StmtStack.back())); ++Idx; } else { - E->setArgument(Reader.GetDeclaratorInfo(Record, Idx)); + E->setArgument(Reader.GetTypeSourceInfo(Record, Idx)); } E->setOperatorLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp index 0e6d1d2f66..a190013177 100644 --- a/lib/Frontend/PCHWriter.cpp +++ b/lib/Frontend/PCHWriter.cpp @@ -2140,7 +2140,7 @@ void PCHWriter::AddTemplateArgumentLoc(const TemplateArgumentLoc &Arg, AddStmt(Arg.getLocInfo().getAsExpr()); break; case TemplateArgument::Type: - AddDeclaratorInfo(Arg.getLocInfo().getAsDeclaratorInfo(), Record); + AddTypeSourceInfo(Arg.getLocInfo().getAsTypeSourceInfo(), Record); break; case TemplateArgument::Template: Record.push_back( @@ -2156,15 +2156,15 @@ void PCHWriter::AddTemplateArgumentLoc(const TemplateArgumentLoc &Arg, } } -void PCHWriter::AddDeclaratorInfo(DeclaratorInfo *DInfo, RecordData &Record) { - if (DInfo == 0) { +void PCHWriter::AddTypeSourceInfo(TypeSourceInfo *TInfo, RecordData &Record) { + if (TInfo == 0) { AddTypeRef(QualType(), Record); return; } - AddTypeRef(DInfo->getType(), Record); + AddTypeRef(TInfo->getType(), Record); TypeLocWriter TLW(*this, Record); - for (TypeLoc TL = DInfo->getTypeLoc(); !TL.isNull(); TL = TL.getNextTypeLoc()) + for (TypeLoc TL = TInfo->getTypeLoc(); !TL.isNull(); TL = TL.getNextTypeLoc()) TLW.Visit(TL); } diff --git a/lib/Frontend/PCHWriterDecl.cpp b/lib/Frontend/PCHWriterDecl.cpp index 64b1aaf478..1ba113e14e 100644 --- a/lib/Frontend/PCHWriterDecl.cpp +++ b/lib/Frontend/PCHWriterDecl.cpp @@ -106,7 +106,7 @@ void PCHDeclWriter::VisitTypeDecl(TypeDecl *D) { void PCHDeclWriter::VisitTypedefDecl(TypedefDecl *D) { VisitTypeDecl(D); - Writer.AddDeclaratorInfo(D->getTypeDeclaratorInfo(), Record); + Writer.AddTypeSourceInfo(D->getTypeSourceInfo(), Record); Code = pch::DECL_TYPEDEF; } @@ -151,7 +151,7 @@ void PCHDeclWriter::VisitEnumConstantDecl(EnumConstantDecl *D) { void PCHDeclWriter::VisitDeclaratorDecl(DeclaratorDecl *D) { VisitValueDecl(D); - Writer.AddDeclaratorInfo(D->getDeclaratorInfo(), Record); + Writer.AddTypeSourceInfo(D->getTypeSourceInfo(), Record); } void PCHDeclWriter::VisitFunctionDecl(FunctionDecl *D) { @@ -370,7 +370,7 @@ void PCHDeclWriter::VisitParmVarDecl(ParmVarDecl *D) { // If the assumptions about the DECL_PARM_VAR abbrev are true, use it. Here // we dynamically check for the properties that we optimize for, but don't // know are true of all PARM_VAR_DECLs. - if (!D->getDeclaratorInfo() && + if (!D->getTypeSourceInfo() && !D->hasAttrs() && !D->isImplicit() && !D->isUsed() && diff --git a/lib/Frontend/PCHWriterStmt.cpp b/lib/Frontend/PCHWriterStmt.cpp index 27b83ed6cb..22f7ad66d9 100644 --- a/lib/Frontend/PCHWriterStmt.cpp +++ b/lib/Frontend/PCHWriterStmt.cpp @@ -388,7 +388,7 @@ void PCHStmtWriter::VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) { VisitExpr(E); Record.push_back(E->isSizeOf()); if (E->isArgumentType()) - Writer.AddDeclaratorInfo(E->getArgumentTypeInfo(), Record); + Writer.AddTypeSourceInfo(E->getArgumentTypeInfo(), Record); else { Record.push_back(0); Writer.WriteSubStmt(E->getArgumentExpr()); diff --git a/lib/Frontend/RewriteObjC.cpp b/lib/Frontend/RewriteObjC.cpp index cd497a7838..df85c13cea 100644 --- a/lib/Frontend/RewriteObjC.cpp +++ b/lib/Frontend/RewriteObjC.cpp @@ -2678,7 +2678,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp) { // Build sizeof(returnType) SizeOfAlignOfExpr *sizeofExpr = new (Context) SizeOfAlignOfExpr(true, - Context->getTrivialDeclaratorInfo(returnType), + Context->getTrivialTypeSourceInfo(returnType), Context->getSizeType(), SourceLocation(), SourceLocation()); // (sizeof(returnType) <= 8 ? objc_msgSend(...) : objc_msgSend_stret(...)) @@ -2718,12 +2718,12 @@ Stmt *RewriteObjC::RewriteMessageExpr(ObjCMessageExpr *Exp) { // typedef struct objc_object Protocol; QualType RewriteObjC::getProtocolType() { if (!ProtocolTypeDecl) { - DeclaratorInfo *DInfo - = Context->getTrivialDeclaratorInfo(Context->getObjCIdType()); + TypeSourceInfo *TInfo + = Context->getTrivialTypeSourceInfo(Context->getObjCIdType()); ProtocolTypeDecl = TypedefDecl::Create(*Context, TUDecl, SourceLocation(), &Context->Idents.get("Protocol"), - DInfo); + TInfo); } return Context->getTypeDeclType(ProtocolTypeDecl); } diff --git a/lib/Index/ASTVisitor.h b/lib/Index/ASTVisitor.h index 0ae78fb74f..6cfa381608 100644 --- a/lib/Index/ASTVisitor.h +++ b/lib/Index/ASTVisitor.h @@ -52,8 +52,8 @@ public: void VisitDeclaratorDecl(DeclaratorDecl *D) { BaseDeclVisitor::VisitDeclaratorDecl(D); - if (DeclaratorInfo *DInfo = D->getDeclaratorInfo()) - Visit(DInfo->getTypeLoc()); + if (TypeSourceInfo *TInfo = D->getTypeSourceInfo()) + Visit(TInfo->getTypeLoc()); } void VisitFunctionDecl(FunctionDecl *D) { diff --git a/lib/Index/ResolveLocation.cpp b/lib/Index/ResolveLocation.cpp index c7379f7a83..81a5de44bf 100644 --- a/lib/Index/ResolveLocation.cpp +++ b/lib/Index/ResolveLocation.cpp @@ -30,7 +30,7 @@ protected: ASTContext &Ctx; SourceLocation Loc; - ASTLocation ResolveInDeclarator(Decl *D, Stmt *Stm, DeclaratorInfo *DInfo); + ASTLocation ResolveInDeclarator(Decl *D, Stmt *Stm, TypeSourceInfo *TInfo); enum RangePos { BeforeLoc, @@ -39,13 +39,13 @@ protected: }; RangePos CheckRange(SourceRange Range); - RangePos CheckRange(DeclaratorInfo *DInfo); + RangePos CheckRange(TypeSourceInfo *TInfo); RangePos CheckRange(Decl *D) { if (DeclaratorDecl *DD = dyn_cast(D)) - if (ContainsLocation(DD->getDeclaratorInfo())) + if (ContainsLocation(DD->getTypeSourceInfo())) return ContainsLoc; if (TypedefDecl *TD = dyn_cast(D)) - if (ContainsLocation(TD->getTypeDeclaratorInfo())) + if (ContainsLocation(TD->getTypeSourceInfo())) return ContainsLoc; return CheckRange(D->getSourceRange()); @@ -142,9 +142,9 @@ StmtLocResolver::VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *Node) { "Should visit only after verifying that loc is in range"); if (Node->isArgumentType()) { - DeclaratorInfo *DInfo = Node->getArgumentTypeInfo(); - if (ContainsLocation(DInfo)) - return ResolveInDeclarator(Parent, Node, DInfo); + TypeSourceInfo *TInfo = Node->getArgumentTypeInfo(); + if (ContainsLocation(TInfo)) + return ResolveInDeclarator(Parent, Node, TInfo); } else { Expr *SubNode = Node->getArgumentExpr(); if (ContainsLocation(SubNode)) @@ -245,8 +245,8 @@ ASTLocation DeclLocResolver::VisitFunctionDecl(FunctionDecl *D) { assert(ContainsLocation(D) && "Should visit only after verifying that loc is in range"); - if (ContainsLocation(D->getDeclaratorInfo())) - return ResolveInDeclarator(D, 0, D->getDeclaratorInfo()); + if (ContainsLocation(D->getTypeSourceInfo())) + return ResolveInDeclarator(D, 0, D->getTypeSourceInfo()); // First, search through the parameters of the function. for (FunctionDecl::param_iterator @@ -296,8 +296,8 @@ ASTLocation DeclLocResolver::VisitFunctionDecl(FunctionDecl *D) { ASTLocation DeclLocResolver::VisitDeclaratorDecl(DeclaratorDecl *D) { assert(ContainsLocation(D) && "Should visit only after verifying that loc is in range"); - if (ContainsLocation(D->getDeclaratorInfo())) - return ResolveInDeclarator(D, /*Stmt=*/0, D->getDeclaratorInfo()); + if (ContainsLocation(D->getTypeSourceInfo())) + return ResolveInDeclarator(D, /*Stmt=*/0, D->getTypeSourceInfo()); return ASTLocation(D); } @@ -306,8 +306,8 @@ ASTLocation DeclLocResolver::VisitTypedefDecl(TypedefDecl *D) { assert(ContainsLocation(D) && "Should visit only after verifying that loc is in range"); - if (ContainsLocation(D->getTypeDeclaratorInfo())) - return ResolveInDeclarator(D, /*Stmt=*/0, D->getTypeDeclaratorInfo()); + if (ContainsLocation(D->getTypeSourceInfo())) + return ResolveInDeclarator(D, /*Stmt=*/0, D->getTypeSourceInfo()); return ASTLocation(D); } @@ -321,8 +321,8 @@ ASTLocation DeclLocResolver::VisitVarDecl(VarDecl *D) { if (Init && ContainsLocation(Init)) return StmtLocResolver(Ctx, Loc, D).Visit(Init); - if (ContainsLocation(D->getDeclaratorInfo())) - return ResolveInDeclarator(D, 0, D->getDeclaratorInfo()); + if (ContainsLocation(D->getTypeSourceInfo())) + return ResolveInDeclarator(D, 0, D->getTypeSourceInfo()); return ASTLocation(D); } @@ -491,12 +491,12 @@ ASTLocation TypeLocResolver::VisitTypeLoc(TypeLoc TL) { } ASTLocation LocResolverBase::ResolveInDeclarator(Decl *D, Stmt *Stm, - DeclaratorInfo *DInfo) { - assert(ContainsLocation(DInfo) && + TypeSourceInfo *TInfo) { + assert(ContainsLocation(TInfo) && "Should visit only after verifying that loc is in range"); (void)TypeLocResolver(Ctx, Loc, D); - for (TypeLoc TL = DInfo->getTypeLoc(); TL; TL = TL.getNextTypeLoc()) + for (TypeLoc TL = TInfo->getTypeLoc(); TL; TL = TL.getNextTypeLoc()) if (ContainsLocation(TL)) return TypeLocResolver(Ctx, Loc, D).Visit(TL); @@ -504,11 +504,11 @@ ASTLocation LocResolverBase::ResolveInDeclarator(Decl *D, Stmt *Stm, return ASTLocation(D, Stm); } -LocResolverBase::RangePos LocResolverBase::CheckRange(DeclaratorInfo *DInfo) { - if (!DInfo) +LocResolverBase::RangePos LocResolverBase::CheckRange(TypeSourceInfo *TInfo) { + if (!TInfo) return BeforeLoc; // Keep looking. - for (TypeLoc TL = DInfo->getTypeLoc(); TL; TL = TL.getNextTypeLoc()) + for (TypeLoc TL = TInfo->getTypeLoc(); TL; TL = TL.getNextTypeLoc()) if (ContainsLocation(TL)) return ContainsLoc; diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index f0812bfe7f..29efbd7bec 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -278,20 +278,20 @@ void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) { PushDeclContext(S, Context.getTranslationUnitDecl()); if (PP.getTargetInfo().getPointerWidth(0) >= 64) { - DeclaratorInfo *DInfo; + TypeSourceInfo *TInfo; // Install [u]int128_t for 64-bit targets. - DInfo = Context.getTrivialDeclaratorInfo(Context.Int128Ty); + TInfo = Context.getTrivialTypeSourceInfo(Context.Int128Ty); PushOnScopeChains(TypedefDecl::Create(Context, CurContext, SourceLocation(), &Context.Idents.get("__int128_t"), - DInfo), TUScope); + TInfo), TUScope); - DInfo = Context.getTrivialDeclaratorInfo(Context.UnsignedInt128Ty); + TInfo = Context.getTrivialTypeSourceInfo(Context.UnsignedInt128Ty); PushOnScopeChains(TypedefDecl::Create(Context, CurContext, SourceLocation(), &Context.Idents.get("__uint128_t"), - DInfo), TUScope); + TInfo), TUScope); } @@ -301,7 +301,7 @@ void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) { if (Context.getObjCSelType().isNull()) { // Create the built-in typedef for 'SEL'. QualType SelT = Context.getPointerType(Context.ObjCBuiltinSelTy); - DeclaratorInfo *SelInfo = Context.getTrivialDeclaratorInfo(SelT); + TypeSourceInfo *SelInfo = Context.getTrivialTypeSourceInfo(SelT); TypedefDecl *SelTypedef = TypedefDecl::Create(Context, CurContext, SourceLocation(), &Context.Idents.get("SEL"), SelInfo); @@ -322,7 +322,7 @@ void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) { // Create the built-in typedef for 'id'. if (Context.getObjCIdType().isNull()) { QualType IdT = Context.getObjCObjectPointerType(Context.ObjCBuiltinIdTy); - DeclaratorInfo *IdInfo = Context.getTrivialDeclaratorInfo(IdT); + TypeSourceInfo *IdInfo = Context.getTrivialTypeSourceInfo(IdT); TypedefDecl *IdTypedef = TypedefDecl::Create(Context, CurContext, SourceLocation(), &Context.Idents.get("id"), IdInfo); @@ -334,7 +334,7 @@ void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) { if (Context.getObjCClassType().isNull()) { QualType ClassType = Context.getObjCObjectPointerType(Context.ObjCBuiltinClassTy); - DeclaratorInfo *ClassInfo = Context.getTrivialDeclaratorInfo(ClassType); + TypeSourceInfo *ClassInfo = Context.getTrivialTypeSourceInfo(ClassType); TypedefDecl *ClassTypedef = TypedefDecl::Create(Context, CurContext, SourceLocation(), &Context.Idents.get("Class"), ClassInfo); diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index 2fb317635f..e4ee8ce73c 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -131,7 +131,7 @@ struct BlockSemaInfo { BlockSemaInfo *PrevBlockInfo; }; -/// \brief Holds a QualType and a DeclaratorInfo* that came out of a declarator +/// \brief Holds a QualType and a TypeSourceInfo* that came out of a declarator /// parsing. /// /// LocInfoType is a "transient" type, only needed for passing to/from Parser @@ -144,17 +144,17 @@ class LocInfoType : public Type { LocInfo = (1 << TypeClassBitSize) - 1 }; - DeclaratorInfo *DeclInfo; + TypeSourceInfo *DeclInfo; - LocInfoType(QualType ty, DeclaratorInfo *DInfo) - : Type((TypeClass)LocInfo, ty, ty->isDependentType()), DeclInfo(DInfo) { + LocInfoType(QualType ty, TypeSourceInfo *TInfo) + : Type((TypeClass)LocInfo, ty, ty->isDependentType()), DeclInfo(TInfo) { assert(getTypeClass() == (TypeClass)LocInfo && "LocInfo didn't fit in TC?"); } friend class Sema; public: QualType getType() const { return getCanonicalTypeInternal(); } - DeclaratorInfo *getDeclaratorInfo() const { return DeclInfo; } + TypeSourceInfo *getTypeSourceInfo() const { return DeclInfo; } virtual void getAsStringInternal(std::string &Str, const PrintingPolicy &Policy) const; @@ -517,14 +517,14 @@ public: QualType BuildBlockPointerType(QualType T, unsigned Quals, SourceLocation Loc, DeclarationName Entity); QualType GetTypeForDeclarator(Declarator &D, Scope *S, - DeclaratorInfo **DInfo = 0, + TypeSourceInfo **TInfo = 0, TagDecl **OwnedDecl = 0); - DeclaratorInfo *GetDeclaratorInfoForDeclarator(Declarator &D, QualType T); - /// \brief Create a LocInfoType to hold the given QualType and DeclaratorInfo. - QualType CreateLocInfoType(QualType T, DeclaratorInfo *DInfo); + TypeSourceInfo *GetTypeSourceInfoForDeclarator(Declarator &D, QualType T); + /// \brief Create a LocInfoType to hold the given QualType and TypeSourceInfo. + QualType CreateLocInfoType(QualType T, TypeSourceInfo *TInfo); DeclarationName GetNameForDeclarator(Declarator &D); DeclarationName GetNameFromUnqualifiedId(const UnqualifiedId &Name); - static QualType GetTypeFromParser(TypeTy *Ty, DeclaratorInfo **DInfo = 0); + static QualType GetTypeFromParser(TypeTy *Ty, TypeSourceInfo **TInfo = 0); bool CheckSpecifiedExceptionType(QualType T, const SourceRange &Range); bool CheckDistantExceptionSpec(QualType T); bool CheckEquivalentExceptionSpec( @@ -596,17 +596,17 @@ public: SourceLocation NameLoc, unsigned Diagnostic); NamedDecl* ActOnTypedefDeclarator(Scope* S, Declarator& D, DeclContext* DC, - QualType R, DeclaratorInfo *DInfo, + QualType R, TypeSourceInfo *TInfo, LookupResult &Previous, bool &Redeclaration); NamedDecl* ActOnVariableDeclarator(Scope* S, Declarator& D, DeclContext* DC, - QualType R, DeclaratorInfo *DInfo, + QualType R, TypeSourceInfo *TInfo, LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, bool &Redeclaration); void CheckVariableDeclaration(VarDecl *NewVD, LookupResult &Previous, bool &Redeclaration); NamedDecl* ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, - QualType R, DeclaratorInfo *DInfo, + QualType R, TypeSourceInfo *TInfo, LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, bool IsFunctionDefinition, @@ -710,7 +710,7 @@ public: AccessSpecifier AS); FieldDecl *CheckFieldDecl(DeclarationName Name, QualType T, - DeclaratorInfo *DInfo, + TypeSourceInfo *TInfo, RecordDecl *Record, SourceLocation Loc, bool Mutable, Expr *BitfieldWidth, SourceLocation TSSL, @@ -823,7 +823,7 @@ public: /// Subroutines of ActOnDeclarator(). TypedefDecl *ParseTypedefDecl(Scope *S, Declarator &D, QualType T, - DeclaratorInfo *DInfo); + TypeSourceInfo *TInfo); void MergeTypeDefDecl(TypedefDecl *New, LookupResult &OldDecls); bool MergeFunctionDecl(FunctionDecl *New, Decl *Old); bool MergeCompatibleFunctionDecls(FunctionDecl *New, FunctionDecl *Old); @@ -1385,7 +1385,7 @@ public: StmtArg SynchBody); VarDecl *BuildExceptionDeclaration(Scope *S, QualType ExDeclType, - DeclaratorInfo *DInfo, + TypeSourceInfo *TInfo, IdentifierInfo *Name, SourceLocation Loc, SourceRange Range); @@ -1505,7 +1505,7 @@ public: virtual OwningExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Op, ExprArg Input); - OwningExprResult CreateSizeOfAlignOfExpr(DeclaratorInfo *T, + OwningExprResult CreateSizeOfAlignOfExpr(TypeSourceInfo *T, SourceLocation OpLoc, bool isSizeOf, SourceRange R); OwningExprResult CreateSizeOfAlignOfExpr(Expr *E, SourceLocation OpLoc, @@ -2131,7 +2131,7 @@ public: SourceLocation RParenLoc); MemInitResult BuildBaseInitializer(QualType BaseType, - DeclaratorInfo *BaseDInfo, + TypeSourceInfo *BaseTInfo, Expr **Args, unsigned NumArgs, SourceLocation LParenLoc, SourceLocation RParenLoc, @@ -2496,7 +2496,7 @@ public: TemplateArgumentListBuilder &Converted); bool CheckTemplateArgument(TemplateTypeParmDecl *Param, - DeclaratorInfo *Arg); + TypeSourceInfo *Arg); bool CheckTemplateArgumentAddressOfObjectOrFunction(Expr *Arg, NamedDecl *&Entity); bool CheckTemplateArgumentPointerToMember(Expr *Arg, @@ -3128,7 +3128,7 @@ public: void PerformPendingImplicitInstantiations(); - DeclaratorInfo *SubstType(DeclaratorInfo *T, + TypeSourceInfo *SubstType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs, SourceLocation Loc, DeclarationName Entity); diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 01314c31cf..a5314bb075 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -588,7 +588,7 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned bid, FunctionDecl *New = FunctionDecl::Create(Context, Context.getTranslationUnitDecl(), - Loc, II, R, /*DInfo=*/0, + Loc, II, R, /*TInfo=*/0, FunctionDecl::Extern, false, /*hasPrototype=*/true); New->setImplicit(); @@ -599,7 +599,7 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned bid, llvm::SmallVector Params; for (unsigned i = 0, e = FT->getNumArgs(); i != e; ++i) Params.push_back(ParmVarDecl::Create(Context, New, SourceLocation(), 0, - FT->getArgType(i), /*DInfo=*/0, + FT->getArgType(i), /*TInfo=*/0, VarDecl::None, 0)); New->setParams(Context, Params.data(), Params.size()); } @@ -924,7 +924,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { ParamType != ParamEnd; ++ParamType) { ParmVarDecl *Param = ParmVarDecl::Create(Context, New, SourceLocation(), 0, - *ParamType, /*DInfo=*/0, + *ParamType, /*TInfo=*/0, VarDecl::None, 0); Param->setImplicit(); Params.push_back(Param); @@ -1678,9 +1678,9 @@ Sema::DeclPtrTy Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, // Mock up a declarator. Declarator Dc(DS, Declarator::TypeNameContext); - DeclaratorInfo *DInfo = 0; - GetTypeForDeclarator(Dc, S, &DInfo); - assert(DInfo && "couldn't build declarator info for anonymous struct/union"); + TypeSourceInfo *TInfo = 0; + GetTypeForDeclarator(Dc, S, &TInfo); + assert(TInfo && "couldn't build declarator info for anonymous struct/union"); // Create a declaration for this anonymous struct/union. NamedDecl *Anon = 0; @@ -1688,7 +1688,7 @@ Sema::DeclPtrTy Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, Anon = FieldDecl::Create(Context, OwningClass, Record->getLocation(), /*IdentifierInfo=*/0, Context.getTypeDeclType(Record), - DInfo, + TInfo, /*BitWidth=*/0, /*Mutable=*/false); Anon->setAccess(AS_public); if (getLangOptions().CPlusPlus) @@ -1715,7 +1715,7 @@ Sema::DeclPtrTy Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, Anon = VarDecl::Create(Context, Owner, Record->getLocation(), /*IdentifierInfo=*/0, Context.getTypeDeclType(Record), - DInfo, + TInfo, SC); } Anon->setImplicit(); @@ -1876,8 +1876,8 @@ Sema::HandleDeclarator(Scope *S, Declarator &D, DeclContext *DC; NamedDecl *New; - DeclaratorInfo *DInfo = 0; - QualType R = GetTypeForDeclarator(D, S, &DInfo); + TypeSourceInfo *TInfo = 0; + QualType R = GetTypeForDeclarator(D, S, &TInfo); LookupResult Previous(*this, Name, D.getIdentifierLoc(), LookupOrdinaryName, ForRedeclaration); @@ -2007,13 +2007,13 @@ Sema::HandleDeclarator(Scope *S, Declarator &D, return DeclPtrTy(); } - New = ActOnTypedefDeclarator(S, D, DC, R, DInfo, Previous, Redeclaration); + New = ActOnTypedefDeclarator(S, D, DC, R, TInfo, Previous, Redeclaration); } else if (R->isFunctionType()) { - New = ActOnFunctionDeclarator(S, D, DC, R, DInfo, Previous, + New = ActOnFunctionDeclarator(S, D, DC, R, TInfo, Previous, move(TemplateParamLists), IsFunctionDefinition, Redeclaration); } else { - New = ActOnVariableDeclarator(S, D, DC, R, DInfo, Previous, + New = ActOnVariableDeclarator(S, D, DC, R, TInfo, Previous, move(TemplateParamLists), Redeclaration); } @@ -2129,7 +2129,7 @@ void Sema::DiagnoseFunctionSpecifiers(Declarator& D) { NamedDecl* Sema::ActOnTypedefDeclarator(Scope* S, Declarator& D, DeclContext* DC, - QualType R, DeclaratorInfo *DInfo, + QualType R, TypeSourceInfo *TInfo, LookupResult &Previous, bool &Redeclaration) { // Typedef declarators cannot be qualified (C++ [dcl.meaning]p1). if (D.getCXXScopeSpec().isSet()) { @@ -2150,7 +2150,7 @@ Sema::ActOnTypedefDeclarator(Scope* S, Declarator& D, DeclContext* DC, if (D.getDeclSpec().isThreadSpecified()) Diag(D.getDeclSpec().getThreadSpecLoc(), diag::err_invalid_thread); - TypedefDecl *NewTD = ParseTypedefDecl(S, D, R, DInfo); + TypedefDecl *NewTD = ParseTypedefDecl(S, D, R, TInfo); if (!NewTD) return 0; // Handle attributes prior to checking for duplicates in MergeVarDecl @@ -2176,7 +2176,7 @@ Sema::ActOnTypedefDeclarator(Scope* S, Declarator& D, DeclContext* DC, TryToFixInvalidVariablyModifiedType(T, Context, SizeIsNegative); if (!FixedTy.isNull()) { Diag(D.getIdentifierLoc(), diag::warn_illegal_constant_array_size); - NewTD->setTypeDeclaratorInfo(Context.getTrivialDeclaratorInfo(FixedTy)); + NewTD->setTypeSourceInfo(Context.getTrivialTypeSourceInfo(FixedTy)); } else { if (SizeIsNegative) Diag(D.getIdentifierLoc(), diag::err_typecheck_negative_array_size); @@ -2269,7 +2269,7 @@ isOutOfScopePreviousDeclaration(NamedDecl *PrevDecl, DeclContext *DC, NamedDecl* Sema::ActOnVariableDeclarator(Scope* S, Declarator& D, DeclContext* DC, - QualType R, DeclaratorInfo *DInfo, + QualType R, TypeSourceInfo *TInfo, LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, bool &Redeclaration) { @@ -2371,7 +2371,7 @@ Sema::ActOnVariableDeclarator(Scope* S, Declarator& D, DeclContext* DC, } NewVD = VarDecl::Create(Context, DC, D.getIdentifierLoc(), - II, R, DInfo, SC); + II, R, TInfo, SC); if (D.isInvalidType()) NewVD->setInvalidDecl(); @@ -2623,7 +2623,7 @@ void Sema::AddOverriddenMethods(CXXRecordDecl *DC, CXXMethodDecl *MD) { NamedDecl* Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, - QualType R, DeclaratorInfo *DInfo, + QualType R, TypeSourceInfo *TInfo, LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, bool IsFunctionDefinition, bool &Redeclaration) { @@ -2705,7 +2705,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, // Create the new declaration NewFD = CXXConstructorDecl::Create(Context, cast(DC), - D.getIdentifierLoc(), Name, R, DInfo, + D.getIdentifierLoc(), Name, R, TInfo, isExplicit, isInline, /*isImplicitlyDeclared=*/false); } else if (Name.getNameKind() == DeclarationName::CXXDestructorName) { @@ -2726,7 +2726,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, // Create a FunctionDecl to satisfy the function definition parsing // code path. NewFD = FunctionDecl::Create(Context, DC, D.getIdentifierLoc(), - Name, R, DInfo, SC, isInline, + Name, R, TInfo, SC, isInline, /*hasPrototype=*/true); D.setInvalidType(); } @@ -2739,7 +2739,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, CheckConversionDeclarator(D, R, SC); NewFD = CXXConversionDecl::Create(Context, cast(DC), - D.getIdentifierLoc(), Name, R, DInfo, + D.getIdentifierLoc(), Name, R, TInfo, isInline, isExplicit); isVirtualOkay = true; @@ -2773,7 +2773,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, // This is a C++ method declaration. NewFD = CXXMethodDecl::Create(Context, cast(DC), - D.getIdentifierLoc(), Name, R, DInfo, + D.getIdentifierLoc(), Name, R, TInfo, isStatic, isInline); isVirtualOkay = !isStatic; @@ -2791,7 +2791,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, NewFD = FunctionDecl::Create(Context, DC, D.getIdentifierLoc(), - Name, R, DInfo, SC, isInline, HasPrototype); + Name, R, TInfo, SC, isInline, HasPrototype); } if (D.isInvalidType()) @@ -2946,7 +2946,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, AE = FT->arg_type_end(); AI != AE; ++AI) { ParmVarDecl *Param = ParmVarDecl::Create(Context, DC, SourceLocation(), 0, - *AI, /*DInfo=*/0, + *AI, /*TInfo=*/0, VarDecl::None, 0); Param->setImplicit(); Params.push_back(Param); @@ -3841,9 +3841,9 @@ Sema::ActOnParamDeclarator(Scope *S, Declarator &D) { if (getLangOptions().CPlusPlus) CheckExtraCXXDefaultArguments(D); - DeclaratorInfo *DInfo = 0; + TypeSourceInfo *TInfo = 0; TagDecl *OwnedDecl = 0; - QualType parmDeclType = GetTypeForDeclarator(D, S, &DInfo, &OwnedDecl); + QualType parmDeclType = GetTypeForDeclarator(D, S, &TInfo, &OwnedDecl); if (getLangOptions().CPlusPlus && OwnedDecl && OwnedDecl->isDefinition()) { // C++ [dcl.fct]p6: @@ -3886,7 +3886,7 @@ Sema::ActOnParamDeclarator(Scope *S, Declarator &D) { ParmVarDecl *New = ParmVarDecl::Create(Context, CurContext, D.getIdentifierLoc(), II, - T, DInfo, StorageClass, 0); + T, TInfo, StorageClass, 0); if (D.isInvalidType()) New->setInvalidDecl(); @@ -4329,20 +4329,20 @@ void Sema::AddKnownFunctionAttributes(FunctionDecl *FD) { } TypedefDecl *Sema::ParseTypedefDecl(Scope *S, Declarator &D, QualType T, - DeclaratorInfo *DInfo) { + TypeSourceInfo *TInfo) { assert(D.getIdentifier() && "Wrong callback for declspec without declarator"); assert(!T.isNull() && "GetTypeForDeclarator() returned null type"); - if (!DInfo) { + if (!TInfo) { assert(D.isInvalidType() && "no declarator info for valid type"); - DInfo = Context.getTrivialDeclaratorInfo(T); + TInfo = Context.getTrivialTypeSourceInfo(T); } // Scope manipulation handled by caller. TypedefDecl *NewTD = TypedefDecl::Create(Context, CurContext, D.getIdentifierLoc(), D.getIdentifier(), - DInfo); + TInfo); if (const TagType *TT = T->getAs()) { TagDecl *TD = TT->getDecl(); @@ -4976,8 +4976,8 @@ FieldDecl *Sema::HandleField(Scope *S, RecordDecl *Record, SourceLocation Loc = DeclStart; if (II) Loc = D.getIdentifierLoc(); - DeclaratorInfo *DInfo = 0; - QualType T = GetTypeForDeclarator(D, S, &DInfo); + TypeSourceInfo *TInfo = 0; + QualType T = GetTypeForDeclarator(D, S, &TInfo); if (getLangOptions().CPlusPlus) CheckExtraCXXDefaultArguments(D); @@ -5003,7 +5003,7 @@ FieldDecl *Sema::HandleField(Scope *S, RecordDecl *Record, = (D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_mutable); SourceLocation TSSL = D.getSourceRange().getBegin(); FieldDecl *NewFD - = CheckFieldDecl(II, T, DInfo, Record, Loc, Mutable, BitWidth, TSSL, + = CheckFieldDecl(II, T, TInfo, Record, Loc, Mutable, BitWidth, TSSL, AS, PrevDecl, &D); if (NewFD->isInvalidDecl() && PrevDecl) { // Don't introduce NewFD into scope; there's already something @@ -5027,7 +5027,7 @@ FieldDecl *Sema::HandleField(Scope *S, RecordDecl *Record, /// /// \todo The Declarator argument is a hack. It will be removed once FieldDecl *Sema::CheckFieldDecl(DeclarationName Name, QualType T, - DeclaratorInfo *DInfo, + TypeSourceInfo *TInfo, RecordDecl *Record, SourceLocation Loc, bool Mutable, Expr *BitWidth, SourceLocation TSSL, @@ -5083,7 +5083,7 @@ FieldDecl *Sema::CheckFieldDecl(DeclarationName Name, QualType T, ZeroWidth = false; } - FieldDecl *NewFD = FieldDecl::Create(Context, Record, Loc, II, T, DInfo, + FieldDecl *NewFD = FieldDecl::Create(Context, Record, Loc, II, T, TInfo, BitWidth, Mutable); if (InvalidDecl) NewFD->setInvalidDecl(); @@ -5330,8 +5330,8 @@ Sema::DeclPtrTy Sema::ActOnIvar(Scope *S, // FIXME: Unnamed fields can be handled in various different ways, for // example, unnamed unions inject all members into the struct namespace! - DeclaratorInfo *DInfo = 0; - QualType T = GetTypeForDeclarator(D, S, &DInfo); + TypeSourceInfo *TInfo = 0; + QualType T = GetTypeForDeclarator(D, S, &TInfo); if (BitWidth) { // 6.7.2.1p3, 6.7.2.1p4 @@ -5374,7 +5374,7 @@ Sema::DeclPtrTy Sema::ActOnIvar(Scope *S, // Construct the decl. ObjCIvarDecl *NewID = ObjCIvarDecl::Create(Context, EnclosingContext, Loc, II, T, - DInfo, ac, (Expr *)BitfieldWidth); + TInfo, ac, (Expr *)BitfieldWidth); if (II) { NamedDecl *PrevDecl = LookupSingleName(S, II, LookupMemberName, diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 2e641d9041..23dccdf62e 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -195,7 +195,7 @@ static void HandleExtVectorTypeAttr(Scope *scope, Decl *d, QualType T = S.BuildExtVectorType(curType, S.Owned(sizeExpr), Attr.getLoc()); if (!T.isNull()) { // FIXME: preserve the old source info. - tDecl->setTypeDeclaratorInfo(S.Context.getTrivialDeclaratorInfo(T)); + tDecl->setTypeSourceInfo(S.Context.getTrivialTypeSourceInfo(T)); // Remember this typedef decl, we will need it later for diagnostics. S.ExtVectorDecls.push_back(tDecl); @@ -1624,7 +1624,7 @@ static void HandleModeAttr(Decl *D, const AttributeList &Attr, Sema &S) { // Install the new type. if (TypedefDecl *TD = dyn_cast(D)) { // FIXME: preserve existing source info. - TD->setTypeDeclaratorInfo(S.Context.getTrivialDeclaratorInfo(NewTy)); + TD->setTypeSourceInfo(S.Context.getTrivialTypeSourceInfo(NewTy)); } else cast(D)->setType(NewTy); } @@ -1977,11 +1977,11 @@ NamedDecl * Sema::DeclClonePragmaWeak(NamedDecl *ND, IdentifierInfo *II) { if (FunctionDecl *FD = dyn_cast(ND)) { NewD = FunctionDecl::Create(FD->getASTContext(), FD->getDeclContext(), FD->getLocation(), DeclarationName(II), - FD->getType(), FD->getDeclaratorInfo()); + FD->getType(), FD->getTypeSourceInfo()); } else if (VarDecl *VD = dyn_cast(ND)) { NewD = VarDecl::Create(VD->getASTContext(), VD->getDeclContext(), VD->getLocation(), II, - VD->getType(), VD->getDeclaratorInfo(), + VD->getType(), VD->getTypeSourceInfo(), VD->getStorageClass()); } return NewD; diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index e115095566..2df172e76e 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -1000,9 +1000,9 @@ Sema::ActOnMemInitializer(DeclPtrTy ConstructorD, // It didn't name a member, so see if it names a class. QualType BaseType; - DeclaratorInfo *DInfo = 0; + TypeSourceInfo *TInfo = 0; if (TemplateTypeTy) - BaseType = GetTypeFromParser(TemplateTypeTy, &DInfo); + BaseType = GetTypeFromParser(TemplateTypeTy, &TInfo); else BaseType = QualType::getFromOpaquePtr(getTypeName(*MemberOrBase, IdLoc, S, &SS)); @@ -1010,10 +1010,10 @@ Sema::ActOnMemInitializer(DeclPtrTy ConstructorD, return Diag(IdLoc, diag::err_mem_init_not_member_or_class) << MemberOrBase << SourceRange(IdLoc, RParenLoc); - if (!DInfo) - DInfo = Context.getTrivialDeclaratorInfo(BaseType, IdLoc); + if (!TInfo) + TInfo = Context.getTrivialTypeSourceInfo(BaseType, IdLoc); - return BuildBaseInitializer(BaseType, DInfo, (Expr **)Args, NumArgs, + return BuildBaseInitializer(BaseType, TInfo, (Expr **)Args, NumArgs, LParenLoc, RParenLoc, ClassDecl); } @@ -1151,7 +1151,7 @@ Sema::BuildMemberInitializer(FieldDecl *Member, Expr **Args, } Sema::MemInitResult -Sema::BuildBaseInitializer(QualType BaseType, DeclaratorInfo *BaseDInfo, +Sema::BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo, Expr **Args, unsigned NumArgs, SourceLocation LParenLoc, SourceLocation RParenLoc, CXXRecordDecl *ClassDecl) { @@ -1159,11 +1159,11 @@ Sema::BuildBaseInitializer(QualType BaseType, DeclaratorInfo *BaseDInfo, for (unsigned i = 0; i < NumArgs; i++) HasDependentArg |= Args[i]->isTypeDependent(); - SourceLocation BaseLoc = BaseDInfo->getTypeLoc().getSourceRange().getBegin(); + SourceLocation BaseLoc = BaseTInfo->getTypeLoc().getSourceRange().getBegin(); if (!BaseType->isDependentType()) { if (!BaseType->isRecordType()) return Diag(BaseLoc, diag::err_base_init_does_not_name_class) - << BaseType << BaseDInfo->getTypeLoc().getSourceRange(); + << BaseType << BaseTInfo->getTypeLoc().getSourceRange(); // C++ [class.base.init]p2: // [...] Unless the mem-initializer-id names a nonstatic data @@ -1210,7 +1210,7 @@ Sema::BuildBaseInitializer(QualType BaseType, DeclaratorInfo *BaseDInfo, // class, the mem-initializer is ill-formed. if (DirectBaseSpec && VirtualBaseSpec) return Diag(BaseLoc, diag::err_base_init_direct_and_virtual) - << BaseType << BaseDInfo->getTypeLoc().getSourceRange(); + << BaseType << BaseTInfo->getTypeLoc().getSourceRange(); // C++ [base.class.init]p2: // Unless the mem-initializer-id names a nonstatic data membeer of the // constructor's class ot a direst or virtual base of that class, the @@ -1218,7 +1218,7 @@ Sema::BuildBaseInitializer(QualType BaseType, DeclaratorInfo *BaseDInfo, if (!DirectBaseSpec && !VirtualBaseSpec) return Diag(BaseLoc, diag::err_not_direct_base_or_virtual) << BaseType << ClassDecl->getNameAsCString() - << BaseDInfo->getTypeLoc().getSourceRange(); + << BaseTInfo->getTypeLoc().getSourceRange(); } CXXConstructorDecl *C = 0; @@ -1245,7 +1245,7 @@ Sema::BuildBaseInitializer(QualType BaseType, DeclaratorInfo *BaseDInfo, // subexpression so we can wrap it in a CXXExprWithTemporaries if necessary. ExprTemporaries.clear(); - return new (Context) CXXBaseOrMemberInitializer(Context, BaseDInfo, C, + return new (Context) CXXBaseOrMemberInitializer(Context, BaseTInfo, C, LParenLoc, (Expr **)Args, NumArgs, RParenLoc); } @@ -1336,7 +1336,7 @@ Sema::SetBaseOrMemberInitializers(CXXConstructorDecl *Constructor, ExprTemporaries.clear(); CXXBaseOrMemberInitializer *Member = new (Context) CXXBaseOrMemberInitializer(Context, - Context.getTrivialDeclaratorInfo(VBase->getType(), + Context.getTrivialTypeSourceInfo(VBase->getType(), SourceLocation()), Ctor, SourceLocation(), @@ -1389,7 +1389,7 @@ Sema::SetBaseOrMemberInitializers(CXXConstructorDecl *Constructor, ExprTemporaries.clear(); CXXBaseOrMemberInitializer *Member = new (Context) CXXBaseOrMemberInitializer(Context, - Context.getTrivialDeclaratorInfo(Base->getType(), + Context.getTrivialTypeSourceInfo(Base->getType(), SourceLocation()), Ctor, SourceLocation(), @@ -2032,7 +2032,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { ClassDecl->getLocation(), Name, Context.getFunctionType(Context.VoidTy, 0, 0, false, 0), - /*DInfo=*/0, + /*TInfo=*/0, /*isExplicit=*/false, /*isInline=*/true, /*isImplicitlyDeclared=*/true); @@ -2104,7 +2104,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { Context.getFunctionType(Context.VoidTy, &ArgType, 1, false, 0), - /*DInfo=*/0, + /*TInfo=*/0, /*isExplicit=*/false, /*isInline=*/true, /*isImplicitlyDeclared=*/true); @@ -2116,7 +2116,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { ParmVarDecl *FromParam = ParmVarDecl::Create(Context, CopyConstructor, ClassDecl->getLocation(), /*IdentifierInfo=*/0, - ArgType, /*DInfo=*/0, + ArgType, /*TInfo=*/0, VarDecl::None, 0); CopyConstructor->setParams(Context, &FromParam, 1); ClassDecl->addDecl(CopyConstructor); @@ -2190,7 +2190,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { CXXMethodDecl::Create(Context, ClassDecl, ClassDecl->getLocation(), Name, Context.getFunctionType(RetType, &ArgType, 1, false, 0), - /*DInfo=*/0, /*isStatic=*/false, /*isInline=*/true); + /*TInfo=*/0, /*isStatic=*/false, /*isInline=*/true); CopyAssignment->setAccess(AS_public); CopyAssignment->setImplicit(); CopyAssignment->setTrivial(ClassDecl->hasTrivialCopyAssignment()); @@ -2200,7 +2200,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { ParmVarDecl *FromParam = ParmVarDecl::Create(Context, CopyAssignment, ClassDecl->getLocation(), /*IdentifierInfo=*/0, - ArgType, /*DInfo=*/0, + ArgType, /*TInfo=*/0, VarDecl::None, 0); CopyAssignment->setParams(Context, &FromParam, 1); @@ -4436,7 +4436,7 @@ Sema::DeclPtrTy Sema::ActOnFinishLinkageSpecification(Scope *S, /// occurs within a C++ catch clause, returning the newly-created /// variable. VarDecl *Sema::BuildExceptionDeclaration(Scope *S, QualType ExDeclType, - DeclaratorInfo *DInfo, + TypeSourceInfo *TInfo, IdentifierInfo *Name, SourceLocation Loc, SourceRange Range) { @@ -4486,7 +4486,7 @@ VarDecl *Sema::BuildExceptionDeclaration(Scope *S, QualType ExDeclType, // FIXME: Need to check for abstract classes. VarDecl *ExDecl = VarDecl::Create(Context, CurContext, Loc, - Name, ExDeclType, DInfo, VarDecl::None); + Name, ExDeclType, TInfo, VarDecl::None); if (Invalid) ExDecl->setInvalidDecl(); @@ -4497,8 +4497,8 @@ VarDecl *Sema::BuildExceptionDeclaration(Scope *S, QualType ExDeclType, /// ActOnExceptionDeclarator - Parsed the exception-declarator in a C++ catch /// handler. Sema::DeclPtrTy Sema::ActOnExceptionDeclarator(Scope *S, Declarator &D) { - DeclaratorInfo *DInfo = 0; - QualType ExDeclType = GetTypeForDeclarator(D, S, &DInfo); + TypeSourceInfo *TInfo = 0; + QualType ExDeclType = GetTypeForDeclarator(D, S, &TInfo); bool Invalid = D.isInvalidType(); IdentifierInfo *II = D.getIdentifier(); @@ -4518,7 +4518,7 @@ Sema::DeclPtrTy Sema::ActOnExceptionDeclarator(Scope *S, Declarator &D) { Invalid = true; } - VarDecl *ExDecl = BuildExceptionDeclaration(S, ExDeclType, DInfo, + VarDecl *ExDecl = BuildExceptionDeclaration(S, ExDeclType, TInfo, D.getIdentifier(), D.getIdentifierLoc(), D.getDeclSpec().getSourceRange()); @@ -4692,8 +4692,8 @@ Sema::ActOnFriendFunctionDecl(Scope *S, assert(DS.getStorageClassSpec() == DeclSpec::SCS_unspecified); SourceLocation Loc = D.getIdentifierLoc(); - DeclaratorInfo *DInfo = 0; - QualType T = GetTypeForDeclarator(D, S, &DInfo); + TypeSourceInfo *TInfo = 0; + QualType T = GetTypeForDeclarator(D, S, &TInfo); // C++ [class.friend]p1 // A friend of a class is a function or class.... @@ -4816,7 +4816,7 @@ Sema::ActOnFriendFunctionDecl(Scope *S, } bool Redeclaration = false; - NamedDecl *ND = ActOnFunctionDeclarator(S, D, DC, T, DInfo, Previous, + NamedDecl *ND = ActOnFunctionDeclarator(S, D, DC, T, TInfo, Previous, move(TemplateParams), IsDefinition, Redeclaration); @@ -5059,9 +5059,9 @@ Sema::ActOnCXXConditionDeclaration(Scope *S, Declarator &D) { assert(D.getDeclSpec().getStorageClassSpec() != DeclSpec::SCS_typedef && "Parser allowed 'typedef' as storage class of condition decl."); - DeclaratorInfo *DInfo = 0; + TypeSourceInfo *TInfo = 0; TagDecl *OwnedTag = 0; - QualType Ty = GetTypeForDeclarator(D, S, &DInfo, &OwnedTag); + QualType Ty = GetTypeForDeclarator(D, S, &TInfo, &OwnedTag); if (Ty->isFunctionType()) { // The declarator shall not specify a function... // We exit without creating a CXXConditionDeclExpr because a FunctionDecl diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 7da37affdc..7f46d2c438 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -1495,7 +1495,7 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property, property->getLocation(), property->getIdentifier(), property->getType(), - /*DInfo=*/0, + /*TInfo=*/0, VarDecl::None, 0); SetterMethod->setMethodParams(Context, &Argument, 1); @@ -1765,7 +1765,7 @@ Sema::DeclPtrTy Sema::ActOnMethodDeclaration( for (unsigned i = 0, e = Sel.getNumArgs(); i != e; ++i) { QualType ArgType; - DeclaratorInfo *DI; + TypeSourceInfo *DI; if (ArgInfo[i].Type == 0) { ArgType = Context.getObjCIdType(); diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index bb040b2ee4..987de9b5b4 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -1713,20 +1713,20 @@ bool Sema::CheckAlignOfExpr(Expr *E, SourceLocation OpLoc, /// \brief Build a sizeof or alignof expression given a type operand. Action::OwningExprResult -Sema::CreateSizeOfAlignOfExpr(DeclaratorInfo *DInfo, +Sema::CreateSizeOfAlignOfExpr(TypeSourceInfo *TInfo, SourceLocation OpLoc, bool isSizeOf, SourceRange R) { - if (!DInfo) + if (!TInfo) return ExprError(); - QualType T = DInfo->getType(); + QualType T = TInfo->getType(); if (!T->isDependentType() && CheckSizeOfAlignOfOperand(T, OpLoc, R, isSizeOf)) return ExprError(); // C99 6.5.3.4p4: the type (an unsigned integer type) is size_t. - return Owned(new (Context) SizeOfAlignOfExpr(isSizeOf, DInfo, + return Owned(new (Context) SizeOfAlignOfExpr(isSizeOf, TInfo, Context.getSizeType(), OpLoc, R.getEnd())); } @@ -1768,9 +1768,9 @@ Sema::ActOnSizeOfAlignOfExpr(SourceLocation OpLoc, bool isSizeof, bool isType, if (TyOrEx == 0) return ExprError(); if (isType) { - DeclaratorInfo *DInfo; - (void) GetTypeFromParser(TyOrEx, &DInfo); - return CreateSizeOfAlignOfExpr(DInfo, OpLoc, isSizeof, ArgRange); + TypeSourceInfo *TInfo; + (void) GetTypeFromParser(TyOrEx, &TInfo); + return CreateSizeOfAlignOfExpr(TInfo, OpLoc, isSizeof, ArgRange); } Expr *ArgEx = (Expr *)TyOrEx; diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 44f7816798..567b488caf 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -321,9 +321,9 @@ Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal, } } - //FIXME: Store DeclaratorInfo in CXXNew expression. - DeclaratorInfo *DInfo = 0; - QualType AllocType = GetTypeForDeclarator(D, /*Scope=*/0, &DInfo); + //FIXME: Store TypeSourceInfo in CXXNew expression. + TypeSourceInfo *TInfo = 0; + QualType AllocType = GetTypeForDeclarator(D, /*Scope=*/0, &TInfo); if (D.isInvalidType()) return ExprError(); @@ -760,10 +760,10 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name, &BadAllocType); FunctionDecl *Alloc = FunctionDecl::Create(Context, GlobalCtx, SourceLocation(), Name, - FnType, /*DInfo=*/0, FunctionDecl::None, false, true); + FnType, /*TInfo=*/0, FunctionDecl::None, false, true); Alloc->setImplicit(); ParmVarDecl *Param = ParmVarDecl::Create(Context, Alloc, SourceLocation(), - 0, Argument, /*DInfo=*/0, + 0, Argument, /*TInfo=*/0, VarDecl::None, 0); Alloc->setParams(Context, &Param, 1); diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 8cd1703436..3ac6bbac5b 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -330,10 +330,10 @@ static TemplateArgumentLoc translateTemplateArgument(Sema &SemaRef, switch (Arg.getKind()) { case ParsedTemplateArgument::Type: { - DeclaratorInfo *DI; + TypeSourceInfo *DI; QualType T = SemaRef.GetTypeFromParser(Arg.getAsType(), &DI); if (!DI) - DI = SemaRef.Context.getTrivialDeclaratorInfo(T, Arg.getLocation()); + DI = SemaRef.Context.getTrivialTypeSourceInfo(T, Arg.getLocation()); return TemplateArgumentLoc(TemplateArgument(T), DI); } @@ -419,10 +419,10 @@ void Sema::ActOnTypeParameterDefault(DeclPtrTy TypeParam, TemplateTypeParmDecl *Parm = cast(TypeParam.getAs()); - DeclaratorInfo *DefaultDInfo; - GetTypeFromParser(DefaultT, &DefaultDInfo); + TypeSourceInfo *DefaultTInfo; + GetTypeFromParser(DefaultT, &DefaultTInfo); - assert(DefaultDInfo && "expected source information for type"); + assert(DefaultTInfo && "expected source information for type"); // C++0x [temp.param]p9: // A default template-argument may be specified for any kind of @@ -437,12 +437,12 @@ void Sema::ActOnTypeParameterDefault(DeclPtrTy TypeParam, // FIXME: Implement this check! Needs a recursive walk over the types. // Check the template argument itself. - if (CheckTemplateArgument(Parm, DefaultDInfo)) { + if (CheckTemplateArgument(Parm, DefaultTInfo)) { Parm->setInvalidDecl(); return; } - Parm->setDefaultArgument(DefaultDInfo, false); + Parm->setDefaultArgument(DefaultTInfo, false); } /// \brief Check that the type of a non-type template parameter is @@ -496,8 +496,8 @@ Sema::CheckNonTypeTemplateParameterType(QualType T, SourceLocation Loc) { Sema::DeclPtrTy Sema::ActOnNonTypeTemplateParameter(Scope *S, Declarator &D, unsigned Depth, unsigned Position) { - DeclaratorInfo *DInfo = 0; - QualType T = GetTypeForDeclarator(D, S, &DInfo); + TypeSourceInfo *TInfo = 0; + QualType T = GetTypeForDeclarator(D, S, &TInfo); assert(S->isTemplateParamScope() && "Non-type template parameter not in template parameter scope!"); @@ -519,7 +519,7 @@ Sema::DeclPtrTy Sema::ActOnNonTypeTemplateParameter(Scope *S, Declarator &D, NonTypeTemplateParmDecl *Param = NonTypeTemplateParmDecl::Create(Context, CurContext, D.getIdentifierLoc(), - Depth, Position, ParamName, T, DInfo); + Depth, Position, ParamName, T, TInfo); if (Invalid) Param->setInvalidDecl(); @@ -1385,7 +1385,7 @@ Sema::ActOnTemplateIdType(TemplateTy TemplateD, SourceLocation TemplateLoc, if (Result.isNull()) return true; - DeclaratorInfo *DI = Context.CreateDeclaratorInfo(Result); + TypeSourceInfo *DI = Context.CreateTypeSourceInfo(Result); TemplateSpecializationTypeLoc TL = cast(DI->getTypeLoc()); TL.setTemplateNameLoc(TemplateLoc); @@ -1405,7 +1405,7 @@ Sema::TypeResult Sema::ActOnTagTemplateIdType(TypeResult TypeResult, return Sema::TypeResult(); // FIXME: preserve source info, ideally without copying the DI. - DeclaratorInfo *DI; + TypeSourceInfo *DI; QualType Type = GetTypeFromParser(TypeResult.get(), &DI); // Verify the tag specifier. @@ -1591,7 +1591,7 @@ bool Sema::CheckTemplateTypeArgument(TemplateTypeParmDecl *Param, return true; } - if (CheckTemplateArgument(Param, AL.getSourceDeclaratorInfo())) + if (CheckTemplateArgument(Param, AL.getTypeSourceInfo())) return true; // Add the converted template type argument. @@ -1622,14 +1622,14 @@ bool Sema::CheckTemplateTypeArgument(TemplateTypeParmDecl *Param, /// parameters that precede \p Param in the template parameter list. /// /// \returns the substituted template argument, or NULL if an error occurred. -static DeclaratorInfo * +static TypeSourceInfo * SubstDefaultTemplateArgument(Sema &SemaRef, TemplateDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, TemplateTypeParmDecl *Param, TemplateArgumentListBuilder &Converted) { - DeclaratorInfo *ArgType = Param->getDefaultArgumentInfo(); + TypeSourceInfo *ArgType = Param->getDefaultArgumentInfo(); // If the argument type is dependent, instantiate it now based // on the previously-computed template arguments. @@ -1755,7 +1755,7 @@ Sema::SubstDefaultTemplateArgumentIfAvailable(TemplateDecl *Template, if (!TypeParm->hasDefaultArgument()) return TemplateArgumentLoc(); - DeclaratorInfo *DI = SubstDefaultTemplateArgument(*this, Template, + TypeSourceInfo *DI = SubstDefaultTemplateArgument(*this, Template, TemplateLoc, RAngleLoc, TypeParm, @@ -2072,7 +2072,7 @@ bool Sema::CheckTemplateArgumentList(TemplateDecl *Template, break; } - DeclaratorInfo *ArgType = SubstDefaultTemplateArgument(*this, + TypeSourceInfo *ArgType = SubstDefaultTemplateArgument(*this, Template, TemplateLoc, RAngleLoc, @@ -2144,8 +2144,8 @@ bool Sema::CheckTemplateArgumentList(TemplateDecl *Template, /// This routine implements the semantics of C++ [temp.arg.type]. It /// returns true if an error occurred, and false otherwise. bool Sema::CheckTemplateArgument(TemplateTypeParmDecl *Param, - DeclaratorInfo *ArgInfo) { - assert(ArgInfo && "invalid DeclaratorInfo"); + TypeSourceInfo *ArgInfo) { + assert(ArgInfo && "invalid TypeSourceInfo"); QualType Arg = ArgInfo->getType(); // C++ [temp.arg.type]p2: diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index b1a58038a9..6158acbe9c 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -544,7 +544,7 @@ namespace { /// \brief Rebuild the exception declaration and register the declaration /// as an instantiated local. VarDecl *RebuildExceptionDecl(VarDecl *ExceptionDecl, QualType T, - DeclaratorInfo *Declarator, + TypeSourceInfo *Declarator, IdentifierInfo *Name, SourceLocation Loc, SourceRange TypeRange); @@ -632,7 +632,7 @@ TemplateInstantiator::TransformFirstQualifierInScope(NamedDecl *D, VarDecl * TemplateInstantiator::RebuildExceptionDecl(VarDecl *ExceptionDecl, QualType T, - DeclaratorInfo *Declarator, + TypeSourceInfo *Declarator, IdentifierInfo *Name, SourceLocation Loc, SourceRange TypeRange) { @@ -889,7 +889,7 @@ TemplateInstantiator::TransformTemplateTypeParmType(TypeLocBuilder &TLB, /// /// \returns If the instantiation succeeds, the instantiated /// type. Otherwise, produces diagnostics and returns a NULL type. -DeclaratorInfo *Sema::SubstType(DeclaratorInfo *T, +TypeSourceInfo *Sema::SubstType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &Args, SourceLocation Loc, DeclarationName Entity) { diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 6b41d9a9b2..432217d3c4 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -127,13 +127,13 @@ TemplateDeclInstantiator::VisitNamespaceDecl(NamespaceDecl *D) { Decl *TemplateDeclInstantiator::VisitTypedefDecl(TypedefDecl *D) { bool Invalid = false; - DeclaratorInfo *DI = D->getTypeDeclaratorInfo(); + TypeSourceInfo *DI = D->getTypeSourceInfo(); if (DI->getType()->isDependentType()) { DI = SemaRef.SubstType(DI, TemplateArgs, D->getLocation(), D->getDeclName()); if (!DI) { Invalid = true; - DI = SemaRef.Context.getTrivialDeclaratorInfo(SemaRef.Context.IntTy); + DI = SemaRef.Context.getTrivialTypeSourceInfo(SemaRef.Context.IntTy); } } @@ -151,7 +151,7 @@ Decl *TemplateDeclInstantiator::VisitTypedefDecl(TypedefDecl *D) { Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D) { // Do substitution on the type of the declaration - DeclaratorInfo *DI = SemaRef.SubstType(D->getDeclaratorInfo(), + TypeSourceInfo *DI = SemaRef.SubstType(D->getTypeSourceInfo(), TemplateArgs, D->getTypeSpecStartLoc(), D->getDeclName()); @@ -251,12 +251,12 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D) { Decl *TemplateDeclInstantiator::VisitFieldDecl(FieldDecl *D) { bool Invalid = false; - DeclaratorInfo *DI = D->getDeclaratorInfo(); + TypeSourceInfo *DI = D->getTypeSourceInfo(); if (DI->getType()->isDependentType()) { DI = SemaRef.SubstType(DI, TemplateArgs, D->getLocation(), D->getDeclName()); if (!DI) { - DI = D->getDeclaratorInfo(); + DI = D->getTypeSourceInfo(); Invalid = true; } else if (DI->getType()->isFunctionType()) { // C++ [temp.arg.type]p3: @@ -646,7 +646,7 @@ Decl *TemplateDeclInstantiator::VisitCXXRecordDecl(CXXRecordDecl *D) { TemplateArgs); FunctionDecl *Function = FunctionDecl::Create(SemaRef.Context, DC, D->getLocation(), - D->getDeclName(), T, D->getDeclaratorInfo(), + D->getDeclName(), T, D->getTypeSourceInfo(), D->getStorageClass(), D->isInlineSpecified(), D->hasWrittenPrototype()); Function->setLexicalDeclContext(Owner); @@ -779,7 +779,7 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D, Method = CXXConstructorDecl::Create(SemaRef.Context, Record, Constructor->getLocation(), Name, T, - Constructor->getDeclaratorInfo(), + Constructor->getTypeSourceInfo(), Constructor->isExplicit(), Constructor->isInlineSpecified(), false); } else if (CXXDestructorDecl *Destructor = dyn_cast(D)) { @@ -797,12 +797,12 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D, ConvTy); Method = CXXConversionDecl::Create(SemaRef.Context, Record, Conversion->getLocation(), Name, - T, Conversion->getDeclaratorInfo(), + T, Conversion->getTypeSourceInfo(), Conversion->isInlineSpecified(), Conversion->isExplicit()); } else { Method = CXXMethodDecl::Create(SemaRef.Context, Record, D->getLocation(), - D->getDeclName(), T, D->getDeclaratorInfo(), + D->getDeclName(), T, D->getTypeSourceInfo(), D->isStatic(), D->isInlineSpecified()); } @@ -895,7 +895,7 @@ Decl *TemplateDeclInstantiator::VisitCXXConversionDecl(CXXConversionDecl *D) { ParmVarDecl *TemplateDeclInstantiator::VisitParmVarDecl(ParmVarDecl *D) { QualType T; - DeclaratorInfo *DI = D->getDeclaratorInfo(); + TypeSourceInfo *DI = D->getTypeSourceInfo(); if (DI) { DI = SemaRef.SubstType(DI, TemplateArgs, D->getLocation(), D->getDeclName()); @@ -957,7 +957,7 @@ Decl *TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl( NonTypeTemplateParmDecl *D) { // Substitute into the type of the non-type template parameter. QualType T; - DeclaratorInfo *DI = D->getDeclaratorInfo(); + TypeSourceInfo *DI = D->getTypeSourceInfo(); if (DI) { DI = SemaRef.SubstType(DI, TemplateArgs, D->getLocation(), D->getDeclName()); @@ -1673,16 +1673,16 @@ Sema::InstantiateMemInitializers(CXXConstructorDecl *New, MemInitResult NewInit; if (Init->isBaseInitializer()) { - DeclaratorInfo *BaseDInfo = SubstType(Init->getBaseClassInfo(), + TypeSourceInfo *BaseTInfo = SubstType(Init->getBaseClassInfo(), TemplateArgs, Init->getSourceLocation(), New->getDeclName()); - if (!BaseDInfo) { + if (!BaseTInfo) { New->setInvalidDecl(); continue; } - NewInit = BuildBaseInitializer(BaseDInfo->getType(), BaseDInfo, + NewInit = BuildBaseInitializer(BaseTInfo->getType(), BaseTInfo, (Expr **)NewArgs.data(), NewArgs.size(), Init->getLParenLoc(), diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index d1ee596b75..e79d9ab721 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -846,20 +846,20 @@ QualType Sema::BuildBlockPointerType(QualType T, unsigned CVR, return Context.getQualifiedType(Context.getBlockPointerType(T), Quals); } -QualType Sema::GetTypeFromParser(TypeTy *Ty, DeclaratorInfo **DInfo) { +QualType Sema::GetTypeFromParser(TypeTy *Ty, TypeSourceInfo **TInfo) { QualType QT = QualType::getFromOpaquePtr(Ty); if (QT.isNull()) { - if (DInfo) *DInfo = 0; + if (TInfo) *TInfo = 0; return QualType(); } - DeclaratorInfo *DI = 0; + TypeSourceInfo *DI = 0; if (LocInfoType *LIT = dyn_cast(QT)) { QT = LIT->getType(); - DI = LIT->getDeclaratorInfo(); + DI = LIT->getTypeSourceInfo(); } - if (DInfo) *DInfo = DI; + if (TInfo) *TInfo = DI; return QT; } @@ -870,7 +870,7 @@ QualType Sema::GetTypeFromParser(TypeTy *Ty, DeclaratorInfo **DInfo) { /// owns the declaration of a type (e.g., the definition of a struct /// type), then *OwnedDecl will receive the owned declaration. QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S, - DeclaratorInfo **DInfo, + TypeSourceInfo **TInfo, TagDecl **OwnedDecl) { // Determine the type of the declarator. Not all forms of declarator // have a type. @@ -1259,11 +1259,11 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S, if (const AttributeList *Attrs = D.getAttributes()) ProcessTypeAttributeList(T, Attrs); - if (DInfo) { + if (TInfo) { if (D.isInvalidType()) - *DInfo = 0; + *TInfo = 0; else - *DInfo = GetDeclaratorInfoForDeclarator(D, T); + *TInfo = GetTypeSourceInfoForDeclarator(D, T); } return T; @@ -1329,18 +1329,18 @@ namespace { } } void VisitTemplateSpecializationTypeLoc(TemplateSpecializationTypeLoc TL) { - DeclaratorInfo *DInfo = 0; - Sema::GetTypeFromParser(DS.getTypeRep(), &DInfo); + TypeSourceInfo *TInfo = 0; + Sema::GetTypeFromParser(DS.getTypeRep(), &TInfo); // If we got no declarator info from previous Sema routines, // just fill with the typespec loc. - if (!DInfo) { + if (!TInfo) { TL.initialize(DS.getTypeSpecTypeLoc()); return; } TemplateSpecializationTypeLoc OldTL = - cast(DInfo->getTypeLoc()); + cast(TInfo->getTypeLoc()); TL.copy(OldTL); } void VisitTypeLoc(TypeLoc TL) { @@ -1416,13 +1416,13 @@ namespace { }; } -/// \brief Create and instantiate a DeclaratorInfo with type source information. +/// \brief Create and instantiate a TypeSourceInfo with type source information. /// /// \param T QualType referring to the type as written in source code. -DeclaratorInfo * -Sema::GetDeclaratorInfoForDeclarator(Declarator &D, QualType T) { - DeclaratorInfo *DInfo = Context.CreateDeclaratorInfo(T); - UnqualTypeLoc CurrTL = DInfo->getTypeLoc().getUnqualifiedLoc(); +TypeSourceInfo * +Sema::GetTypeSourceInfoForDeclarator(Declarator &D, QualType T) { + TypeSourceInfo *TInfo = Context.CreateTypeSourceInfo(T); + UnqualTypeLoc CurrTL = TInfo->getTypeLoc().getUnqualifiedLoc(); for (unsigned i = 0, e = D.getNumTypeObjects(); i != e; ++i) { DeclaratorLocFiller(D.getTypeObject(i)).Visit(CurrTL); @@ -1431,16 +1431,16 @@ Sema::GetDeclaratorInfoForDeclarator(Declarator &D, QualType T) { TypeSpecLocFiller(D.getDeclSpec()).Visit(CurrTL); - return DInfo; + return TInfo; } -/// \brief Create a LocInfoType to hold the given QualType and DeclaratorInfo. -QualType Sema::CreateLocInfoType(QualType T, DeclaratorInfo *DInfo) { +/// \brief Create a LocInfoType to hold the given QualType and TypeSourceInfo. +QualType Sema::CreateLocInfoType(QualType T, TypeSourceInfo *TInfo) { // FIXME: LocInfoTypes are "transient", only needed for passing to/from Parser // and Sema during declaration parsing. Try deallocating/caching them when // it's appropriate, instead of allocating them and keeping them around. LocInfoType *LocT = (LocInfoType*)BumpAlloc.Allocate(sizeof(LocInfoType), 8); - new (LocT) LocInfoType(T, DInfo); + new (LocT) LocInfoType(T, TInfo); assert(LocT->getTypeClass() != T->getTypeClass() && "LocInfoType's TypeClass conflicts with an existing Type class"); return QualType(LocT, 0); @@ -1515,9 +1515,9 @@ Sema::TypeResult Sema::ActOnTypeName(Scope *S, Declarator &D) { // the parser. assert(D.getIdentifier() == 0 && "Type name should have no identifier!"); - DeclaratorInfo *DInfo = 0; + TypeSourceInfo *TInfo = 0; TagDecl *OwnedTag = 0; - QualType T = GetTypeForDeclarator(D, S, &DInfo, &OwnedTag); + QualType T = GetTypeForDeclarator(D, S, &TInfo, &OwnedTag); if (D.isInvalidType()) return true; @@ -1534,8 +1534,8 @@ Sema::TypeResult Sema::ActOnTypeName(Scope *S, Declarator &D) { << Context.getTypeDeclType(OwnedTag); } - if (DInfo) - T = CreateLocInfoType(T, DInfo); + if (TInfo) + T = CreateLocInfoType(T, TInfo); return T.getAsOpaquePtr(); } diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index 8c251e7040..5f2ae604de 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -175,10 +175,10 @@ public: /// \brief Transforms the given type into another type. /// /// By default, this routine transforms a type by creating a - /// DeclaratorInfo for it and delegating to the appropriate + /// TypeSourceInfo for it and delegating to the appropriate /// function. This is expensive, but we don't mind, because /// this method is deprecated anyway; all users should be - /// switched to storing DeclaratorInfos. + /// switched to storing TypeSourceInfos. /// /// \returns the transformed type. QualType TransformType(QualType T); @@ -191,7 +191,7 @@ public: /// may override this function (to take over all type /// transformations) or some set of the TransformXXXType functions /// to alter the transformation. - DeclaratorInfo *TransformType(DeclaratorInfo *DI); + TypeSourceInfo *TransformType(TypeSourceInfo *DI); /// \brief Transform the given type-with-location into a new /// type, collecting location information in the given builder @@ -301,9 +301,9 @@ public: void InventTemplateArgumentLoc(const TemplateArgument &Arg, TemplateArgumentLoc &ArgLoc); - /// \brief Fakes up a DeclaratorInfo for a type. - DeclaratorInfo *InventDeclaratorInfo(QualType T) { - return SemaRef.Context.getTrivialDeclaratorInfo(T, + /// \brief Fakes up a TypeSourceInfo for a type. + TypeSourceInfo *InventTypeSourceInfo(QualType T) { + return SemaRef.Context.getTrivialTypeSourceInfo(T, getDerived().getBaseLocation()); } @@ -783,7 +783,7 @@ public: /// By default, performs semantic analysis to build the new decaration. /// Subclasses may override this routine to provide different behavior. VarDecl *RebuildExceptionDecl(VarDecl *ExceptionDecl, QualType T, - DeclaratorInfo *Declarator, + TypeSourceInfo *Declarator, IdentifierInfo *Name, SourceLocation Loc, SourceRange TypeRange) { @@ -894,10 +894,10 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildSizeOfAlignOf(DeclaratorInfo *DInfo, + OwningExprResult RebuildSizeOfAlignOf(TypeSourceInfo *TInfo, SourceLocation OpLoc, bool isSizeOf, SourceRange R) { - return getSema().CreateSizeOfAlignOfExpr(DInfo, OpLoc, isSizeOf, R); + return getSema().CreateSizeOfAlignOfExpr(TInfo, OpLoc, isSizeOf, R); } /// \brief Build a new sizeof or alignof expression with an expression @@ -1890,7 +1890,7 @@ void TreeTransform::InventTemplateArgumentLoc( case TemplateArgument::Type: Output = TemplateArgumentLoc(Arg, - SemaRef.Context.getTrivialDeclaratorInfo(Arg.getAsType(), Loc)); + SemaRef.Context.getTrivialTypeSourceInfo(Arg.getAsType(), Loc)); break; @@ -1922,9 +1922,9 @@ bool TreeTransform::TransformTemplateArgument( return false; case TemplateArgument::Type: { - DeclaratorInfo *DI = Input.getSourceDeclaratorInfo(); + TypeSourceInfo *DI = Input.getTypeSourceInfo(); if (DI == NULL) - DI = InventDeclaratorInfo(Input.getArgument().getAsType()); + DI = InventTypeSourceInfo(Input.getArgument().getAsType()); DI = getDerived().TransformType(DI); if (!DI) return true; @@ -2031,10 +2031,10 @@ QualType TreeTransform::TransformType(QualType T) { // Temporary workaround. All of these transformations should // eventually turn into transformations on TypeLocs. - DeclaratorInfo *DI = getSema().Context.CreateDeclaratorInfo(T); + TypeSourceInfo *DI = getSema().Context.CreateTypeSourceInfo(T); DI->getTypeLoc().initialize(getDerived().getBaseLocation()); - DeclaratorInfo *NewDI = getDerived().TransformType(DI); + TypeSourceInfo *NewDI = getDerived().TransformType(DI); if (!NewDI) return QualType(); @@ -2043,7 +2043,7 @@ QualType TreeTransform::TransformType(QualType T) { } template -DeclaratorInfo *TreeTransform::TransformType(DeclaratorInfo *DI) { +TypeSourceInfo *TreeTransform::TransformType(TypeSourceInfo *DI) { if (getDerived().AlreadyTransformed(DI->getType())) return DI; @@ -2056,7 +2056,7 @@ DeclaratorInfo *TreeTransform::TransformType(DeclaratorInfo *DI) { if (Result.isNull()) return 0; - return TLB.getDeclaratorInfo(SemaRef.Context, Result); + return TLB.getTypeSourceInfo(SemaRef.Context, Result); } template @@ -2504,10 +2504,10 @@ TreeTransform::TransformFunctionProtoType(TypeLocBuilder &TLB, ParmVarDecl *NewParm; if (OldParm) { - DeclaratorInfo *OldDI = OldParm->getDeclaratorInfo(); + TypeSourceInfo *OldDI = OldParm->getTypeSourceInfo(); assert(OldDI->getType() == T->getArgType(i)); - DeclaratorInfo *NewDI = getDerived().TransformType(OldDI); + TypeSourceInfo *NewDI = getDerived().TransformType(OldDI); if (!NewDI) return QualType(); @@ -2660,7 +2660,7 @@ QualType TreeTransform::TransformTypeOfType(TypeLocBuilder &TLB, TypeOfTypeLoc TL) { TypeOfType *T = TL.getTypePtr(); - // FIXME: should be an inner type, or at least have a DeclaratorInfo. + // FIXME: should be an inner type, or at least have a TypeSourceInfo. QualType Underlying = getDerived().TransformType(T->getUnderlyingType()); if (Underlying.isNull()) return QualType(); @@ -3402,7 +3402,7 @@ TreeTransform::TransformCXXCatchStmt(CXXCatchStmt *S) { Var = getDerived().RebuildExceptionDecl(ExceptionDecl, T, - ExceptionDecl->getDeclaratorInfo(), + ExceptionDecl->getTypeSourceInfo(), ExceptionDecl->getIdentifier(), ExceptionDecl->getLocation(), /*FIXME: Inaccurate*/ @@ -3583,9 +3583,9 @@ Sema::OwningExprResult TreeTransform::TransformSizeOfAlignOfExpr(SizeOfAlignOfExpr *E, bool isAddressOfOperand) { if (E->isArgumentType()) { - DeclaratorInfo *OldT = E->getArgumentTypeInfo(); + TypeSourceInfo *OldT = E->getArgumentTypeInfo(); - DeclaratorInfo *NewT = getDerived().TransformType(OldT); + TypeSourceInfo *NewT = getDerived().TransformType(OldT); if (!NewT) return SemaRef.ExprError();