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
///
/// \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
///
/// 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<PointerLoc>(&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; }
};
/// \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;
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;
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);
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,
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 {
}
QualType getOriginalType() const {
- if (getDeclaratorInfo())
- return getDeclaratorInfo()->getType();
+ if (getTypeSourceInfo())
+ return getTypeSourceInfo()->getType();
return getType();
}
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),
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);
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; }
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.
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);
/// };
/// @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<DeclaratorInfo *, FieldDecl *> BaseOrMember;
+ llvm::PointerUnion<TypeSourceInfo *, FieldDecl *> BaseOrMember;
/// \brief The source location for the field name.
SourceLocation MemberLocation;
/// 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);
/// isBaseInitializer - Returns true when this initializer is
/// initializing a base class.
- bool isBaseInitializer() const { return BaseOrMember.is<DeclaratorInfo*>(); }
+ bool isBaseInitializer() const { return BaseOrMember.is<TypeSourceInfo*>(); }
/// isMemberInitializer - Returns true when this initializer is
/// initializing a non-static data member.
Type *getBaseClass();
/// \brief Returns the declarator information for a base class initializer.
- DeclaratorInfo *getBaseClassInfo() const {
- return BaseOrMember.dyn_cast<DeclaratorInfo *>();
+ TypeSourceInfo *getBaseClassInfo() const {
+ return BaseOrMember.dyn_cast<TypeSourceInfo *>();
}
/// getMember - If this is a member initializer, returns the
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);
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);
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);
}
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
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; }
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:
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)
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;
/// \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;
}
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;
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;
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,
QualType getArgumentType() const {
return getArgumentTypeInfo()->getType();
}
- DeclaratorInfo *getArgumentTypeInfo() const {
+ TypeSourceInfo *getArgumentTypeInfo() const {
assert(isArgumentType() && "calling getArgumentType() when arg is expr");
return Argument.Ty;
}
}
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;
}
class Decl;
class Expr;
-class DeclaratorInfo;
+class TypeSourceInfo;
/// \brief Represents a template argument within a class template
/// specialization.
private:
union {
Expr *Expression;
- DeclaratorInfo *Declarator;
+ TypeSourceInfo *Declarator;
struct {
unsigned QualifierRange[2];
unsigned TemplateNameLoc;
#ifndef NDEBUG
enum Kind {
K_None,
- K_DeclaratorInfo,
+ K_TypeSourceInfo,
K_Expression,
K_Template
} Kind;
#endif
{}
- TemplateArgumentLocInfo(DeclaratorInfo *DInfo)
- : Declarator(DInfo)
+ TemplateArgumentLocInfo(TypeSourceInfo *TInfo)
+ : Declarator(TInfo)
#ifndef NDEBUG
- , Kind(K_DeclaratorInfo)
+ , Kind(K_TypeSourceInfo)
#endif
{}
Template.TemplateNameLoc = TemplateNameLoc.getRawEncoding();
}
- DeclaratorInfo *getAsDeclaratorInfo() const {
- assert(Kind == K_DeclaratorInfo);
+ TypeSourceInfo *getAsTypeSourceInfo() const {
+ assert(Kind == K_TypeSourceInfo);
return Declarator;
}
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:
: 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);
}
return LocInfo;
}
- DeclaratorInfo *getSourceDeclaratorInfo() const {
+ TypeSourceInfo *getTypeSourceInfo() const {
assert(Argument.getKind() == TemplateArgument::Type);
- return LocInfo.getAsDeclaratorInfo();
+ return LocInfo.getAsTypeSourceInfo();
}
Expr *getSourceExpression() const {
namespace clang {
class ParmVarDecl;
- class DeclaratorInfo;
+ class TypeSourceInfo;
class UnqualTypeLoc;
// Predeclare all the type nodes.
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);
break;
case TemplateArgument::Type:
- Info = TemplateArgumentLocInfo((DeclaratorInfo*) 0);
+ Info = TemplateArgumentLocInfo((TypeSourceInfo*) 0);
break;
case TemplateArgument::Template:
TypeOfExprType> {
};
-// 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<TypeSpecTypeLoc,
TypeOfTypeLoc,
return cast<TyLocType>(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;
}
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
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,
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;
}
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);
FieldDecl *Field = FieldDecl::Create(*this,
ObjCFastEnumerationStateTypeDecl,
SourceLocation(), 0,
- FieldTypes[i], /*DInfo=*/0,
+ FieldTypes[i], /*TInfo=*/0,
/*BitWidth=*/0,
/*Mutable=*/false);
ObjCFastEnumerationStateTypeDecl->addDecl(Field);
T,
SourceLocation(),
&Idents.get(FieldNames[i]),
- FieldTypes[i], /*DInfo=*/0,
+ FieldTypes[i], /*TInfo=*/0,
/*BitWidth=*/0,
/*Mutable=*/false);
T->addDecl(Field);
T,
SourceLocation(),
&Idents.get(FieldNames[i]),
- FieldTypes[i], /*DInfo=*/0,
+ FieldTypes[i], /*TInfo=*/0,
/*BitWidth=*/0,
/*Mutable=*/false);
T->addDecl(Field);
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);
}
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);
}
FieldType);
FieldDecl *Field = FieldDecl::Create(*this, T, SourceLocation(),
- Name, FieldType, /*DInfo=*/0,
+ Name, FieldType, /*TInfo=*/0,
/*BitWidth=*/0, /*Mutable=*/false);
T->addDecl(Field);
}
}
/// \brief Return the TypeLoc wrapper for the type source info.
-TypeLoc DeclaratorInfo::getTypeLoc() const {
+TypeLoc TypeSourceInfo::getTypeLoc() const {
return TypeLoc(Ty, (void*)(this + 1));
}
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 {
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;
}
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 {
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,
//===----------------------------------------------------------------------===//
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) {
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);
}
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) {
TypeLoc CXXBaseOrMemberInitializer::getBaseClassLoc() const {
if (isBaseInitializer())
- return BaseOrMember.get<DeclaratorInfo*>()->getTypeLoc();
+ return BaseOrMember.get<TypeSourceInfo*>()->getTypeLoc();
else
return TypeLoc();
}
Type *CXXBaseOrMemberInitializer::getBaseClass() {
if (isBaseInitializer())
- return BaseOrMember.get<DeclaratorInfo*>()->getType().getTypePtr();
+ return BaseOrMember.get<TypeSourceInfo*>()->getType().getTypePtr();
else
return 0;
}
const Type *CXXBaseOrMemberInitializer::getBaseClass() const {
if (isBaseInitializer())
- return BaseOrMember.get<DeclaratorInfo*>()->getType().getTypePtr();
+ return BaseOrMember.get<TypeSourceInfo*>()->getType().getTypePtr();
else
return 0;
}
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);
}
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,
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);
}
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 {
return getSourceDeclExpression()->getSourceRange();
case TemplateArgument::Type:
- return getSourceDeclaratorInfo()->getTypeLoc().getFullSourceRange();
+ return getTypeSourceInfo()->getTypeLoc().getFullSourceRange();
case TemplateArgument::Template:
if (getTemplateQualifierRange().isValid())
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) {
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++]),
// 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());
}
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) {
E->setArgument(cast<Expr>(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++]));
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(
}
}
-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);
}
void PCHDeclWriter::VisitTypedefDecl(TypedefDecl *D) {
VisitTypeDecl(D);
- Writer.AddDeclaratorInfo(D->getTypeDeclaratorInfo(), Record);
+ Writer.AddTypeSourceInfo(D->getTypeSourceInfo(), Record);
Code = pch::DECL_TYPEDEF;
}
void PCHDeclWriter::VisitDeclaratorDecl(DeclaratorDecl *D) {
VisitValueDecl(D);
- Writer.AddDeclaratorInfo(D->getDeclaratorInfo(), Record);
+ Writer.AddTypeSourceInfo(D->getTypeSourceInfo(), Record);
}
void PCHDeclWriter::VisitFunctionDecl(FunctionDecl *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() &&
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());
// 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(...))
// 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);
}
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) {
ASTContext &Ctx;
SourceLocation Loc;
- ASTLocation ResolveInDeclarator(Decl *D, Stmt *Stm, DeclaratorInfo *DInfo);
+ ASTLocation ResolveInDeclarator(Decl *D, Stmt *Stm, TypeSourceInfo *TInfo);
enum RangePos {
BeforeLoc,
};
RangePos CheckRange(SourceRange Range);
- RangePos CheckRange(DeclaratorInfo *DInfo);
+ RangePos CheckRange(TypeSourceInfo *TInfo);
RangePos CheckRange(Decl *D) {
if (DeclaratorDecl *DD = dyn_cast<DeclaratorDecl>(D))
- if (ContainsLocation(DD->getDeclaratorInfo()))
+ if (ContainsLocation(DD->getTypeSourceInfo()))
return ContainsLoc;
if (TypedefDecl *TD = dyn_cast<TypedefDecl>(D))
- if (ContainsLocation(TD->getTypeDeclaratorInfo()))
+ if (ContainsLocation(TD->getTypeSourceInfo()))
return ContainsLoc;
return CheckRange(D->getSourceRange());
"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))
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
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);
}
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);
}
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);
}
}
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);
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;
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);
}
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);
// 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);
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);
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
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;
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(
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,
AccessSpecifier AS);
FieldDecl *CheckFieldDecl(DeclarationName Name, QualType T,
- DeclaratorInfo *DInfo,
+ TypeSourceInfo *TInfo,
RecordDecl *Record, SourceLocation Loc,
bool Mutable, Expr *BitfieldWidth,
SourceLocation TSSL,
/// 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);
StmtArg SynchBody);
VarDecl *BuildExceptionDeclaration(Scope *S, QualType ExDeclType,
- DeclaratorInfo *DInfo,
+ TypeSourceInfo *TInfo,
IdentifierInfo *Name,
SourceLocation Loc,
SourceRange Range);
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,
SourceLocation RParenLoc);
MemInitResult BuildBaseInitializer(QualType BaseType,
- DeclaratorInfo *BaseDInfo,
+ TypeSourceInfo *BaseTInfo,
Expr **Args, unsigned NumArgs,
SourceLocation LParenLoc,
SourceLocation RParenLoc,
TemplateArgumentListBuilder &Converted);
bool CheckTemplateArgument(TemplateTypeParmDecl *Param,
- DeclaratorInfo *Arg);
+ TypeSourceInfo *Arg);
bool CheckTemplateArgumentAddressOfObjectOrFunction(Expr *Arg,
NamedDecl *&Entity);
bool CheckTemplateArgumentPointerToMember(Expr *Arg,
void PerformPendingImplicitInstantiations();
- DeclaratorInfo *SubstType(DeclaratorInfo *T,
+ TypeSourceInfo *SubstType(TypeSourceInfo *T,
const MultiLevelTemplateArgumentList &TemplateArgs,
SourceLocation Loc, DeclarationName Entity);
FunctionDecl *New = FunctionDecl::Create(Context,
Context.getTranslationUnitDecl(),
- Loc, II, R, /*DInfo=*/0,
+ Loc, II, R, /*TInfo=*/0,
FunctionDecl::Extern, false,
/*hasPrototype=*/true);
New->setImplicit();
llvm::SmallVector<ParmVarDecl*, 16> 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());
}
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);
// 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;
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)
Anon = VarDecl::Create(Context, Owner, Record->getLocation(),
/*IdentifierInfo=*/0,
Context.getTypeDeclType(Record),
- DInfo,
+ TInfo,
SC);
}
Anon->setImplicit();
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);
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);
}
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()) {
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
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);
NamedDecl*
Sema::ActOnVariableDeclarator(Scope* S, Declarator& D, DeclContext* DC,
- QualType R, DeclaratorInfo *DInfo,
+ QualType R, TypeSourceInfo *TInfo,
LookupResult &Previous,
MultiTemplateParamsArg TemplateParamLists,
bool &Redeclaration) {
}
NewVD = VarDecl::Create(Context, DC, D.getIdentifierLoc(),
- II, R, DInfo, SC);
+ II, R, TInfo, SC);
if (D.isInvalidType())
NewVD->setInvalidDecl();
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) {
// Create the new declaration
NewFD = CXXConstructorDecl::Create(Context,
cast<CXXRecordDecl>(DC),
- D.getIdentifierLoc(), Name, R, DInfo,
+ D.getIdentifierLoc(), Name, R, TInfo,
isExplicit, isInline,
/*isImplicitlyDeclared=*/false);
} else if (Name.getNameKind() == DeclarationName::CXXDestructorName) {
// 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();
}
CheckConversionDeclarator(D, R, SC);
NewFD = CXXConversionDecl::Create(Context, cast<CXXRecordDecl>(DC),
- D.getIdentifierLoc(), Name, R, DInfo,
+ D.getIdentifierLoc(), Name, R, TInfo,
isInline, isExplicit);
isVirtualOkay = true;
// This is a C++ method declaration.
NewFD = CXXMethodDecl::Create(Context, cast<CXXRecordDecl>(DC),
- D.getIdentifierLoc(), Name, R, DInfo,
+ D.getIdentifierLoc(), Name, R, TInfo,
isStatic, isInline);
isVirtualOkay = !isStatic;
NewFD = FunctionDecl::Create(Context, DC,
D.getIdentifierLoc(),
- Name, R, DInfo, SC, isInline, HasPrototype);
+ Name, R, TInfo, SC, isInline, HasPrototype);
}
if (D.isInvalidType())
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);
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:
ParmVarDecl *New
= ParmVarDecl::Create(Context, CurContext, D.getIdentifierLoc(), II,
- T, DInfo, StorageClass, 0);
+ T, TInfo, StorageClass, 0);
if (D.isInvalidType())
New->setInvalidDecl();
}
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<TagType>()) {
TagDecl *TD = TT->getDecl();
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);
= (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
///
/// \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,
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();
// 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
// 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,
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);
// Install the new type.
if (TypedefDecl *TD = dyn_cast<TypedefDecl>(D)) {
// FIXME: preserve existing source info.
- TD->setTypeDeclaratorInfo(S.Context.getTrivialDeclaratorInfo(NewTy));
+ TD->setTypeSourceInfo(S.Context.getTrivialTypeSourceInfo(NewTy));
} else
cast<ValueDecl>(D)->setType(NewTy);
}
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(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<VarDecl>(ND)) {
NewD = VarDecl::Create(VD->getASTContext(), VD->getDeclContext(),
VD->getLocation(), II,
- VD->getType(), VD->getDeclaratorInfo(),
+ VD->getType(), VD->getTypeSourceInfo(),
VD->getStorageClass());
}
return NewD;
// 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));
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);
}
}
Sema::MemInitResult
-Sema::BuildBaseInitializer(QualType BaseType, DeclaratorInfo *BaseDInfo,
+Sema::BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo,
Expr **Args, unsigned NumArgs,
SourceLocation LParenLoc, SourceLocation RParenLoc,
CXXRecordDecl *ClassDecl) {
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
// 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
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;
// 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);
}
ExprTemporaries.clear();
CXXBaseOrMemberInitializer *Member =
new (Context) CXXBaseOrMemberInitializer(Context,
- Context.getTrivialDeclaratorInfo(VBase->getType(),
+ Context.getTrivialTypeSourceInfo(VBase->getType(),
SourceLocation()),
Ctor,
SourceLocation(),
ExprTemporaries.clear();
CXXBaseOrMemberInitializer *Member =
new (Context) CXXBaseOrMemberInitializer(Context,
- Context.getTrivialDeclaratorInfo(Base->getType(),
+ Context.getTrivialTypeSourceInfo(Base->getType(),
SourceLocation()),
Ctor,
SourceLocation(),
ClassDecl->getLocation(), Name,
Context.getFunctionType(Context.VoidTy,
0, 0, false, 0),
- /*DInfo=*/0,
+ /*TInfo=*/0,
/*isExplicit=*/false,
/*isInline=*/true,
/*isImplicitlyDeclared=*/true);
Context.getFunctionType(Context.VoidTy,
&ArgType, 1,
false, 0),
- /*DInfo=*/0,
+ /*TInfo=*/0,
/*isExplicit=*/false,
/*isInline=*/true,
/*isImplicitlyDeclared=*/true);
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);
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());
ParmVarDecl *FromParam = ParmVarDecl::Create(Context, CopyAssignment,
ClassDecl->getLocation(),
/*IdentifierInfo=*/0,
- ArgType, /*DInfo=*/0,
+ ArgType, /*TInfo=*/0,
VarDecl::None, 0);
CopyAssignment->setParams(Context, &FromParam, 1);
/// 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) {
// 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();
/// 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();
Invalid = true;
}
- VarDecl *ExDecl = BuildExceptionDeclaration(S, ExDeclType, DInfo,
+ VarDecl *ExDecl = BuildExceptionDeclaration(S, ExDeclType, TInfo,
D.getIdentifier(),
D.getIdentifierLoc(),
D.getDeclSpec().getSourceRange());
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....
}
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);
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
property->getLocation(),
property->getIdentifier(),
property->getType(),
- /*DInfo=*/0,
+ /*TInfo=*/0,
VarDecl::None,
0);
SetterMethod->setMethodParams(Context, &Argument, 1);
for (unsigned i = 0, e = Sel.getNumArgs(); i != e; ++i) {
QualType ArgType;
- DeclaratorInfo *DI;
+ TypeSourceInfo *DI;
if (ArgInfo[i].Type == 0) {
ArgType = Context.getObjCIdType();
/// \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()));
}
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;
}
}
- //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();
&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);
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);
}
TemplateTypeParmDecl *Parm
= cast<TemplateTypeParmDecl>(TypeParam.getAs<Decl>());
- 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
// 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
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!");
NonTypeTemplateParmDecl *Param
= NonTypeTemplateParmDecl::Create(Context, CurContext, D.getIdentifierLoc(),
- Depth, Position, ParamName, T, DInfo);
+ Depth, Position, ParamName, T, TInfo);
if (Invalid)
Param->setInvalidDecl();
if (Result.isNull())
return true;
- DeclaratorInfo *DI = Context.CreateDeclaratorInfo(Result);
+ TypeSourceInfo *DI = Context.CreateTypeSourceInfo(Result);
TemplateSpecializationTypeLoc TL
= cast<TemplateSpecializationTypeLoc>(DI->getTypeLoc());
TL.setTemplateNameLoc(TemplateLoc);
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.
return true;
}
- if (CheckTemplateArgument(Param, AL.getSourceDeclaratorInfo()))
+ if (CheckTemplateArgument(Param, AL.getTypeSourceInfo()))
return true;
// Add the converted template type argument.
/// 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.
if (!TypeParm->hasDefaultArgument())
return TemplateArgumentLoc();
- DeclaratorInfo *DI = SubstDefaultTemplateArgument(*this, Template,
+ TypeSourceInfo *DI = SubstDefaultTemplateArgument(*this, Template,
TemplateLoc,
RAngleLoc,
TypeParm,
break;
}
- DeclaratorInfo *ArgType = SubstDefaultTemplateArgument(*this,
+ TypeSourceInfo *ArgType = SubstDefaultTemplateArgument(*this,
Template,
TemplateLoc,
RAngleLoc,
/// 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:
/// \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);
VarDecl *
TemplateInstantiator::RebuildExceptionDecl(VarDecl *ExceptionDecl,
QualType T,
- DeclaratorInfo *Declarator,
+ TypeSourceInfo *Declarator,
IdentifierInfo *Name,
SourceLocation Loc,
SourceRange TypeRange) {
///
/// \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) {
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);
}
}
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());
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:
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);
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<CXXDestructorDecl>(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());
}
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());
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());
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(),
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<LocInfoType>(QT)) {
QT = LIT->getType();
- DI = LIT->getDeclaratorInfo();
+ DI = LIT->getTypeSourceInfo();
}
- if (DInfo) *DInfo = DI;
+ if (TInfo) *TInfo = DI;
return QT;
}
/// 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.
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;
}
}
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<TemplateSpecializationTypeLoc>(DInfo->getTypeLoc());
+ cast<TemplateSpecializationTypeLoc>(TInfo->getTypeLoc());
TL.copy(OldTL);
}
void VisitTypeLoc(TypeLoc TL) {
};
}
-/// \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);
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);
// 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;
<< Context.getTypeDeclType(OwnedTag);
}
- if (DInfo)
- T = CreateLocInfoType(T, DInfo);
+ if (TInfo)
+ T = CreateLocInfoType(T, TInfo);
return T.getAsOpaquePtr();
}
/// \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);
/// 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
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());
}
/// 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) {
///
/// 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
case TemplateArgument::Type:
Output = TemplateArgumentLoc(Arg,
- SemaRef.Context.getTrivialDeclaratorInfo(Arg.getAsType(), Loc));
+ SemaRef.Context.getTrivialTypeSourceInfo(Arg.getAsType(), Loc));
break;
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;
// 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();
}
template<typename Derived>
-DeclaratorInfo *TreeTransform<Derived>::TransformType(DeclaratorInfo *DI) {
+TypeSourceInfo *TreeTransform<Derived>::TransformType(TypeSourceInfo *DI) {
if (getDerived().AlreadyTransformed(DI->getType()))
return DI;
if (Result.isNull())
return 0;
- return TLB.getDeclaratorInfo(SemaRef.Context, Result);
+ return TLB.getTypeSourceInfo(SemaRef.Context, Result);
}
template<typename Derived>
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();
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();
Var = getDerived().RebuildExceptionDecl(ExceptionDecl,
T,
- ExceptionDecl->getDeclaratorInfo(),
+ ExceptionDecl->getTypeSourceInfo(),
ExceptionDecl->getIdentifier(),
ExceptionDecl->getLocation(),
/*FIXME: Inaccurate*/
TreeTransform<Derived>::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();