Introduce DeclaratorDecl and pass DeclaratorInfo through the Decl/Sema interfaces.

DeclaratorDecl contains a DeclaratorInfo* to keep type source info.
Subclasses of DeclaratorDecl are FieldDecl, FunctionDecl, and VarDecl.
EnumConstantDecl still inherits from ValueDecl since it has no need for DeclaratorInfo.

Decl/Sema interfaces accept a DeclaratorInfo as parameter but no DeclaratorInfo is created yet.

llvm-svn: 79392
This commit is contained in:
Argyrios Kyrtzidis 2009-08-19 01:27:57 +00:00
parent 3f79ad7405
commit 60ed560428
24 changed files with 273 additions and 182 deletions

View File

@ -223,6 +223,27 @@ public:
static bool classof(const ValueDecl *D) { return true; }
};
/// \brief Represents a ValueDecl that came out of a declarator.
/// Contains type source information through DeclaratorInfo.
class DeclaratorDecl : public ValueDecl {
DeclaratorInfo *DeclInfo;
protected:
DeclaratorDecl(Kind DK, DeclContext *DC, SourceLocation L,
DeclarationName N, QualType T, DeclaratorInfo *DInfo)
: ValueDecl(DK, DC, L, N, T), DeclInfo(DInfo) {}
public:
DeclaratorInfo *getDeclaratorInfo() const { return DeclInfo; }
void setDeclaratorInfo(DeclaratorInfo *DInfo) { DeclInfo = DInfo; }
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) {
return D->getKind() >= DeclaratorFirst && D->getKind() <= DeclaratorLast;
}
static bool classof(const DeclaratorDecl *D) { return true; }
};
/// \brief Structure used to store a statement, the constant value to
/// which it was evaluated (if any), and whether or not the statement
/// is an integral constant expression (if known).
@ -246,7 +267,7 @@ struct EvaluatedStmt {
/// VarDecl - An instance of this class is created to represent a variable
/// declaration or definition.
class VarDecl : public ValueDecl, public Redeclarable<VarDecl> {
class VarDecl : public DeclaratorDecl, public Redeclarable<VarDecl> {
public:
enum StorageClass {
None, Auto, Register, Extern, Static, PrivateExtern
@ -283,8 +304,9 @@ private:
friend class StmtIteratorBase;
protected:
VarDecl(Kind DK, DeclContext *DC, SourceLocation L, IdentifierInfo *Id,
QualType T, StorageClass SC, SourceLocation TSSL = SourceLocation())
: ValueDecl(DK, DC, L, Id, T), Init(),
QualType T, DeclaratorInfo *DInfo,
StorageClass SC, SourceLocation TSSL = SourceLocation())
: DeclaratorDecl(DK, DC, L, Id, T, DInfo), Init(),
ThreadSpecified(false), HasCXXDirectInit(false),
DeclaredInCondition(false), TypeSpecStartLoc(TSSL) {
SClass = SC;
@ -304,7 +326,7 @@ public:
static VarDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation L, IdentifierInfo *Id,
QualType T, StorageClass S,
QualType T, DeclaratorInfo *DInfo, StorageClass S,
SourceLocation TypeSpecStartLoc = SourceLocation());
virtual ~VarDecl();
@ -315,6 +337,7 @@ public:
virtual SourceRange getSourceRange() const;
//FIXME: Use DeclaratorInfo for this.
SourceLocation getTypeSpecStartLoc() const { return TypeSpecStartLoc; }
void setTypeSpecStartLoc(SourceLocation SL) {
TypeSpecStartLoc = SL;
@ -537,7 +560,7 @@ class ImplicitParamDecl : public VarDecl {
protected:
ImplicitParamDecl(Kind DK, DeclContext *DC, SourceLocation L,
IdentifierInfo *Id, QualType Tw)
: VarDecl(DK, DC, L, Id, Tw, VarDecl::None) {}
: VarDecl(DK, DC, L, Id, Tw, /*DInfo=*/0, VarDecl::None) {}
public:
static ImplicitParamDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation L, IdentifierInfo *Id,
@ -564,16 +587,17 @@ class ParmVarDecl : public VarDecl {
protected:
ParmVarDecl(Kind DK, DeclContext *DC, SourceLocation L,
IdentifierInfo *Id, QualType T, StorageClass S,
Expr *DefArg)
: VarDecl(DK, DC, L, Id, T, S), objcDeclQualifier(OBJC_TQ_None) {
IdentifierInfo *Id, QualType T, DeclaratorInfo *DInfo,
StorageClass S, Expr *DefArg)
: VarDecl(DK, DC, L, Id, T, DInfo, S), objcDeclQualifier(OBJC_TQ_None) {
setDefaultArg(DefArg);
}
public:
static ParmVarDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation L,IdentifierInfo *Id,
QualType T, StorageClass S, Expr *DefArg);
QualType T, DeclaratorInfo *DInfo,
StorageClass S, Expr *DefArg);
ObjCDeclQualifier getObjCDeclQualifier() const {
return ObjCDeclQualifier(objcDeclQualifier);
@ -649,15 +673,17 @@ protected:
QualType OriginalType;
private:
OriginalParmVarDecl(DeclContext *DC, SourceLocation L,
IdentifierInfo *Id, QualType T,
IdentifierInfo *Id, QualType T,
DeclaratorInfo *DInfo,
QualType OT, StorageClass S,
Expr *DefArg)
: ParmVarDecl(OriginalParmVar, DC, L, Id, T, S, DefArg), OriginalType(OT) {}
: ParmVarDecl(OriginalParmVar, DC, L, Id, T, DInfo, S, DefArg),
OriginalType(OT) {}
public:
static OriginalParmVarDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation L,IdentifierInfo *Id,
QualType T, QualType OT,
StorageClass S, Expr *DefArg);
QualType T, DeclaratorInfo *DInfo,
QualType OT, StorageClass S, Expr *DefArg);
void setOriginalType(QualType T) { OriginalType = T; }
@ -677,7 +703,7 @@ public:
/// contains all of the information known about the function. Other,
/// previous declarations of the function are available via the
/// getPreviousDeclaration() chain.
class FunctionDecl : public ValueDecl, public DeclContext,
class FunctionDecl : public DeclaratorDecl, public DeclContext,
public Redeclarable<FunctionDecl> {
public:
enum StorageClass {
@ -736,10 +762,10 @@ private:
protected:
FunctionDecl(Kind DK, DeclContext *DC, SourceLocation L,
DeclarationName N, QualType T,
DeclarationName N, QualType T, DeclaratorInfo *DInfo,
StorageClass S, bool isInline,
SourceLocation TSSL = SourceLocation())
: ValueDecl(DK, DC, L, N, T),
: DeclaratorDecl(DK, DC, L, N, T, DInfo),
DeclContext(DK),
ParamInfo(0), Body(),
SClass(S), IsInline(isInline), C99InlineDefinition(false),
@ -765,7 +791,8 @@ public:
}
static FunctionDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L,
DeclarationName N, QualType T,
DeclarationName N, QualType T,
DeclaratorInfo *DInfo,
StorageClass S = None, bool isInline = false,
bool hasWrittenPrototype = true,
SourceLocation TSStartLoc = SourceLocation());
@ -777,6 +804,7 @@ public:
EndRangeLoc = E;
}
//FIXME: Use DeclaratorInfo for this.
SourceLocation getTypeSpecStartLoc() const { return TypeSpecStartLoc; }
void setTypeSpecStartLoc(SourceLocation TS) { TypeSpecStartLoc = TS; }
@ -1059,21 +1087,22 @@ public:
/// FieldDecl - An instance of this class is created by Sema::ActOnField to
/// represent a member of a struct/union/class.
class FieldDecl : public ValueDecl {
class FieldDecl : public DeclaratorDecl {
// FIXME: This can be packed into the bitfields in Decl.
bool Mutable : 1;
Expr *BitWidth;
SourceLocation TypeSpecStartLoc;
protected:
FieldDecl(Kind DK, DeclContext *DC, SourceLocation L,
IdentifierInfo *Id, QualType T, Expr *BW, bool Mutable,
SourceLocation TSSL = SourceLocation())
: ValueDecl(DK, DC, L, Id, T), Mutable(Mutable), BitWidth(BW),
IdentifierInfo *Id, QualType T, DeclaratorInfo *DInfo,
Expr *BW, bool Mutable, SourceLocation TSSL = SourceLocation())
: DeclaratorDecl(DK, DC, L, Id, T, DInfo), Mutable(Mutable), BitWidth(BW),
TypeSpecStartLoc(TSSL) { }
public:
static FieldDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L,
IdentifierInfo *Id, QualType T, Expr *BW,
IdentifierInfo *Id, QualType T,
DeclaratorInfo *DInfo, Expr *BW,
bool Mutable,
SourceLocation TypeSpecStartLoc = SourceLocation());
@ -1083,6 +1112,7 @@ public:
/// \brief Set whether this field is mutable (C++ only).
void setMutable(bool M) { Mutable = M; }
//FIXME: Use DeclaratorInfo for this.
SourceLocation getTypeSpecStartLoc() const { return TypeSpecStartLoc; }
void setTypeSpecStartLoc(SourceLocation TSSL) { TypeSpecStartLoc = TSSL; }

View File

@ -716,15 +716,16 @@ public:
class CXXMethodDecl : public FunctionDecl {
protected:
CXXMethodDecl(Kind DK, CXXRecordDecl *RD, SourceLocation L,
DeclarationName N, QualType T,
DeclarationName N, QualType T, DeclaratorInfo *DInfo,
bool isStatic, bool isInline)
: FunctionDecl(DK, RD, L, N, T, (isStatic ? Static : None),
: FunctionDecl(DK, RD, L, N, T, DInfo, (isStatic ? Static : None),
isInline) {}
public:
static CXXMethodDecl *Create(ASTContext &C, CXXRecordDecl *RD,
SourceLocation L, DeclarationName N,
QualType T, bool isStatic = false,
QualType T, DeclaratorInfo *DInfo,
bool isStatic = false,
bool isInline = false);
bool isStatic() const { return getStorageClass() == Static; }
@ -948,9 +949,9 @@ class CXXConstructorDecl : public CXXMethodDecl {
unsigned NumBaseOrMemberInitializers;
CXXConstructorDecl(CXXRecordDecl *RD, SourceLocation L,
DeclarationName N, QualType T,
DeclarationName N, QualType T, DeclaratorInfo *DInfo,
bool isExplicit, bool isInline, bool isImplicitlyDeclared)
: CXXMethodDecl(CXXConstructor, RD, L, N, T, false, isInline),
: CXXMethodDecl(CXXConstructor, RD, L, N, T, DInfo, false, isInline),
Explicit(isExplicit), ImplicitlyDefined(false),
BaseOrMemberInitializers(0), NumBaseOrMemberInitializers(0) {
setImplicit(isImplicitlyDeclared);
@ -960,7 +961,8 @@ class CXXConstructorDecl : public CXXMethodDecl {
public:
static CXXConstructorDecl *Create(ASTContext &C, CXXRecordDecl *RD,
SourceLocation L, DeclarationName N,
QualType T, bool isExplicit,
QualType T, DeclaratorInfo *DInfo,
bool isExplicit,
bool isInline, bool isImplicitlyDeclared);
/// isExplicit - Whether this constructor was marked "explicit" or not.
@ -1093,7 +1095,7 @@ class CXXDestructorDecl : public CXXMethodDecl {
CXXDestructorDecl(CXXRecordDecl *RD, SourceLocation L,
DeclarationName N, QualType T,
bool isInline, bool isImplicitlyDeclared)
: CXXMethodDecl(CXXDestructor, RD, L, N, T, false, isInline),
: CXXMethodDecl(CXXDestructor, RD, L, N, T, /*DInfo=*/0, false, isInline),
ImplicitlyDefined(false),
BaseOrMemberDestructions(0), NumBaseOrMemberDestructions(0) {
setImplicit(isImplicitlyDeclared);
@ -1231,16 +1233,16 @@ class CXXConversionDecl : public CXXMethodDecl {
bool Explicit : 1;
CXXConversionDecl(CXXRecordDecl *RD, SourceLocation L,
DeclarationName N, QualType T,
DeclarationName N, QualType T, DeclaratorInfo *DInfo,
bool isInline, bool isExplicit)
: CXXMethodDecl(CXXConversion, RD, L, N, T, false, isInline),
: CXXMethodDecl(CXXConversion, RD, L, N, T, DInfo, false, isInline),
Explicit(isExplicit) { }
public:
static CXXConversionDecl *Create(ASTContext &C, CXXRecordDecl *RD,
SourceLocation L, DeclarationName N,
QualType T, bool isInline,
bool isExplicit);
QualType T, DeclaratorInfo *DInfo,
bool isInline, bool isExplicit);
/// isExplicit - Whether this is an explicit conversion operator
/// (C++0x only). Explicit conversion operators are only considered
@ -1267,17 +1269,17 @@ class FriendFunctionDecl : public FunctionDecl {
const SourceLocation FriendLoc;
FriendFunctionDecl(DeclContext *DC, SourceLocation L,
DeclarationName N, QualType T,
DeclarationName N, QualType T, DeclaratorInfo *DInfo,
bool isInline, SourceLocation FriendL)
: FunctionDecl(FriendFunction, DC, L, N, T, None, isInline),
: FunctionDecl(FriendFunction, DC, L, N, T, DInfo, None, isInline),
FriendLoc(FriendL)
{}
public:
static FriendFunctionDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation L, DeclarationName N,
QualType T, bool isInline,
SourceLocation FriendL);
QualType T, DeclaratorInfo *DInfo,
bool isInline, SourceLocation FriendL);
SourceLocation getFriendLoc() const {
return FriendLoc;

View File

@ -91,20 +91,21 @@ ABSTRACT_DECL(Named, Decl)
DECL(TemplateTypeParm, TypeDecl)
ABSTRACT_DECL(Value, NamedDecl)
DECL(EnumConstant, ValueDecl)
DECL(Function, ValueDecl)
DECL(FriendFunction, FunctionDecl)
DECL(CXXMethod, FunctionDecl)
DECL(CXXConstructor, CXXMethodDecl)
DECL(CXXDestructor, CXXMethodDecl)
DECL(CXXConversion, CXXMethodDecl)
DECL(Field, ValueDecl)
DECL(ObjCIvar, FieldDecl)
DECL(ObjCAtDefsField, FieldDecl)
DECL(Var, ValueDecl)
DECL(ImplicitParam, VarDecl)
DECL(ParmVar, VarDecl)
DECL(OriginalParmVar, ParmVarDecl)
DECL(NonTypeTemplateParm, VarDecl)
ABSTRACT_DECL(Declarator, NamedDecl)
DECL(Function, ValueDecl)
DECL(FriendFunction, FunctionDecl)
DECL(CXXMethod, FunctionDecl)
DECL(CXXConstructor, CXXMethodDecl)
DECL(CXXDestructor, CXXMethodDecl)
DECL(CXXConversion, CXXMethodDecl)
DECL(Field, ValueDecl)
DECL(ObjCIvar, FieldDecl)
DECL(ObjCAtDefsField, FieldDecl)
DECL(Var, ValueDecl)
DECL(ImplicitParam, VarDecl)
DECL(ParmVar, VarDecl)
DECL(OriginalParmVar, ParmVarDecl)
DECL(NonTypeTemplateParm, VarDecl)
DECL(Template, NamedDecl)
DECL(FunctionTemplate, TemplateDecl)
DECL(ClassTemplate, TemplateDecl)
@ -147,6 +148,7 @@ DECL_RANGE(Type, Typedef, TemplateTypeParm)
DECL_RANGE(Tag, Enum, ClassTemplatePartialSpecialization)
DECL_RANGE(Record, Record, ClassTemplatePartialSpecialization)
DECL_RANGE(Value, EnumConstant, NonTypeTemplateParm)
DECL_RANGE(Declarator, Function, NonTypeTemplateParm)
DECL_RANGE(Function, Function, CXXConversion)
DECL_RANGE(Template, Template, TemplateTemplateParm)
DECL_RANGE(ObjCImpl, ObjCCategoryImpl, ObjCImplementation)

View File

@ -568,13 +568,14 @@ public:
private:
ObjCIvarDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id,
QualType T, AccessControl ac, Expr *BW)
: FieldDecl(ObjCIvar, DC, L, Id, T, BW, /*Mutable=*/false),
QualType T, DeclaratorInfo *DInfo, AccessControl ac, Expr *BW)
: FieldDecl(ObjCIvar, DC, L, Id, T, DInfo, BW, /*Mutable=*/false),
DeclAccess(ac) {}
public:
static ObjCIvarDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L,
IdentifierInfo *Id, QualType T,
DeclaratorInfo *DInfo,
AccessControl ac, Expr *BW = NULL);
void setAccessControl(AccessControl ac) { DeclAccess = ac; }
@ -600,7 +601,9 @@ class ObjCAtDefsFieldDecl : public FieldDecl {
private:
ObjCAtDefsFieldDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id,
QualType T, Expr *BW)
: FieldDecl(ObjCAtDefsField, DC, L, Id, T, BW, /*Mutable=*/false) {}
: FieldDecl(ObjCAtDefsField, DC, L, Id, T,
/*DInfo=*/0, // FIXME: Do ObjCAtDefs have declarators ?
BW, /*Mutable=*/false) {}
public:
static ObjCAtDefsFieldDecl *Create(ASTContext &C, DeclContext *DC,

View File

@ -747,15 +747,16 @@ class NonTypeTemplateParmDecl
NonTypeTemplateParmDecl(DeclContext *DC, SourceLocation L, unsigned D,
unsigned P, IdentifierInfo *Id, QualType T,
DeclaratorInfo *DInfo,
SourceLocation TSSL = SourceLocation())
: VarDecl(NonTypeTemplateParm, DC, L, Id, T, VarDecl::None, TSSL),
: VarDecl(NonTypeTemplateParm, DC, L, Id, T, DInfo, VarDecl::None, TSSL),
TemplateParmPosition(D, P), DefaultArgument(0)
{ }
public:
static NonTypeTemplateParmDecl *
Create(ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D,
unsigned P, IdentifierInfo *Id, QualType T,
unsigned P, IdentifierInfo *Id, QualType T, DeclaratorInfo *DInfo,
SourceLocation TypeSpecStartLoc = SourceLocation());
using TemplateParmPosition::getDepth;

View File

@ -2549,7 +2549,8 @@ QualType ASTContext::getCFConstantStringType() {
for (unsigned i = 0; i < 4; ++i) {
FieldDecl *Field = FieldDecl::Create(*this, CFConstantStringTypeDecl,
SourceLocation(), 0,
FieldTypes[i], /*BitWidth=*/0,
FieldTypes[i], /*DInfo=*/0,
/*BitWidth=*/0,
/*Mutable=*/false);
CFConstantStringTypeDecl->addDecl(Field);
}
@ -2585,7 +2586,8 @@ QualType ASTContext::getObjCFastEnumerationStateType()
FieldDecl *Field = FieldDecl::Create(*this,
ObjCFastEnumerationStateTypeDecl,
SourceLocation(), 0,
FieldTypes[i], /*BitWidth=*/0,
FieldTypes[i], /*DInfo=*/0,
/*BitWidth=*/0,
/*Mutable=*/false);
ObjCFastEnumerationStateTypeDecl->addDecl(Field);
}

View File

@ -84,9 +84,9 @@ const char *VarDecl::getStorageClassSpecifierString(StorageClass SC) {
ParmVarDecl *ParmVarDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation L, IdentifierInfo *Id,
QualType T, StorageClass S,
Expr *DefArg) {
return new (C) ParmVarDecl(ParmVar, DC, L, Id, T, S, DefArg);
QualType T, DeclaratorInfo *DInfo,
StorageClass S, Expr *DefArg) {
return new (C) ParmVarDecl(ParmVar, DC, L, Id, T, DInfo, S, DefArg);
}
QualType ParmVarDecl::getOriginalType() const {
@ -130,19 +130,20 @@ bool VarDecl::isExternC(ASTContext &Context) const {
OriginalParmVarDecl *OriginalParmVarDecl::Create(
ASTContext &C, DeclContext *DC,
SourceLocation L, IdentifierInfo *Id,
QualType T, QualType OT, StorageClass S,
Expr *DefArg) {
return new (C) OriginalParmVarDecl(DC, L, Id, T, OT, S, DefArg);
QualType T, DeclaratorInfo *DInfo,
QualType OT, StorageClass S, Expr *DefArg) {
return new (C) OriginalParmVarDecl(DC, L, Id, T, DInfo, OT, S, DefArg);
}
FunctionDecl *FunctionDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation L,
DeclarationName N, QualType T,
DeclarationName N, QualType T,
DeclaratorInfo *DInfo,
StorageClass S, bool isInline,
bool hasWrittenPrototype,
SourceLocation TypeSpecStartLoc) {
FunctionDecl *New
= new (C) FunctionDecl(Function, DC, L, N, T, S, isInline,
= new (C) FunctionDecl(Function, DC, L, N, T, DInfo, S, isInline,
TypeSpecStartLoc);
New->HasWrittenPrototype = hasWrittenPrototype;
return New;
@ -153,9 +154,10 @@ BlockDecl *BlockDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L) {
}
FieldDecl *FieldDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,
IdentifierInfo *Id, QualType T, Expr *BW,
IdentifierInfo *Id, QualType T,
DeclaratorInfo *DInfo, Expr *BW,
bool Mutable, SourceLocation TSSL) {
return new (C) FieldDecl(Decl::Field, DC, L, Id, T, BW, Mutable, TSSL);
return new (C) FieldDecl(Decl::Field, DC, L, Id, T, DInfo, BW, Mutable, TSSL);
}
bool FieldDecl::isAnonymousStructOrUnion() const {
@ -319,9 +321,9 @@ NamedDecl *NamedDecl::getUnderlyingDecl() {
//===----------------------------------------------------------------------===//
VarDecl *VarDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,
IdentifierInfo *Id, QualType T, StorageClass S,
SourceLocation TypeSpecStartLoc) {
return new (C) VarDecl(Var, DC, L, Id, T, S, TypeSpecStartLoc);
IdentifierInfo *Id, QualType T, DeclaratorInfo *DInfo,
StorageClass S, SourceLocation TypeSpecStartLoc) {
return new (C) VarDecl(Var, DC, L, Id, T, DInfo, S, TypeSpecStartLoc);
}
void VarDecl::Destroy(ASTContext& C) {

View File

@ -321,8 +321,10 @@ CXXRecordDecl::getDestructor(ASTContext &Context) {
CXXMethodDecl *
CXXMethodDecl::Create(ASTContext &C, CXXRecordDecl *RD,
SourceLocation L, DeclarationName N,
QualType T, bool isStatic, bool isInline) {
return new (C) CXXMethodDecl(CXXMethod, RD, L, N, T, isStatic, isInline);
QualType T, DeclaratorInfo *DInfo,
bool isStatic, bool isInline) {
return new (C) CXXMethodDecl(CXXMethod, RD, L, N, T, DInfo,
isStatic, isInline);
}
@ -428,11 +430,12 @@ CXXBaseOrMemberInitializer::~CXXBaseOrMemberInitializer() {
CXXConstructorDecl *
CXXConstructorDecl::Create(ASTContext &C, CXXRecordDecl *RD,
SourceLocation L, DeclarationName N,
QualType T, bool isExplicit,
QualType T, DeclaratorInfo *DInfo,
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, isExplicit, isInline,
return new (C) CXXConstructorDecl(RD, L, N, T, DInfo, isExplicit, isInline,
isImplicitlyDeclared);
}
@ -694,10 +697,11 @@ CXXConstructorDecl::Destroy(ASTContext& C) {
CXXConversionDecl *
CXXConversionDecl::Create(ASTContext &C, CXXRecordDecl *RD,
SourceLocation L, DeclarationName N,
QualType T, bool isInline, bool isExplicit) {
QualType T, DeclaratorInfo *DInfo,
bool isInline, bool isExplicit) {
assert(N.getNameKind() == DeclarationName::CXXConversionFunctionName &&
"Name must refer to a conversion function");
return new (C) CXXConversionDecl(RD, L, N, T, isInline, isExplicit);
return new (C) CXXConversionDecl(RD, L, N, T, DInfo, isInline, isExplicit);
}
OverloadedFunctionDecl *
@ -748,9 +752,10 @@ FriendFunctionDecl *FriendFunctionDecl::Create(ASTContext &C,
DeclContext *DC,
SourceLocation L,
DeclarationName N, QualType T,
DeclaratorInfo *DInfo,
bool isInline,
SourceLocation FriendL) {
return new (C) FriendFunctionDecl(DC, L, N, T, isInline, FriendL);
return new (C) FriendFunctionDecl(DC, L, N, T, DInfo, isInline, FriendL);
}
FriendClassDecl *FriendClassDecl::Create(ASTContext &C, DeclContext *DC,

View File

@ -449,8 +449,9 @@ bool ObjCInterfaceDecl::ClassImplementsProtocol(ObjCProtocolDecl *lProto,
ObjCIvarDecl *ObjCIvarDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation L, IdentifierInfo *Id,
QualType T, AccessControl ac, Expr *BW) {
return new (C) ObjCIvarDecl(DC, L, Id, T, ac, BW);
QualType T, DeclaratorInfo *DInfo,
AccessControl ac, Expr *BW) {
return new (C) ObjCIvarDecl(DC, L, Id, T, DInfo, ac, BW);
}

View File

@ -236,8 +236,9 @@ NonTypeTemplateParmDecl *
NonTypeTemplateParmDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation L, unsigned D, unsigned P,
IdentifierInfo *Id, QualType T,
DeclaratorInfo *DInfo,
SourceLocation TypeSpecStartLoc) {
return new (C) NonTypeTemplateParmDecl(DC, L, D, P, Id, T,
return new (C) NonTypeTemplateParmDecl(DC, L, D, P, Id, T, DInfo,
TypeSpecStartLoc);
}

View File

@ -694,7 +694,7 @@ uint64_t BlockFunction::getBlockOffset(const BlockDeclRefExpr *BDRE) {
llvm::APInt(32, Pad),
ArrayType::Normal, 0);
ValueDecl *PadDecl = VarDecl::Create(getContext(), 0, SourceLocation(),
0, QualType(PadTy), VarDecl::None,
0, QualType(PadTy), 0, VarDecl::None,
SourceLocation());
Expr *E;
E = new (getContext()) DeclRefExpr(PadDecl, PadDecl->getType(),
@ -742,7 +742,7 @@ GenerateCopyHelperFunction(bool BlockHasCopyDispose, const llvm::StructType *T,
FunctionDecl *FD = FunctionDecl::Create(getContext(),
getContext().getTranslationUnitDecl(),
SourceLocation(), II, R,
SourceLocation(), II, R, 0,
FunctionDecl::Static, false,
true);
CGF.StartFunction(FD, R, Fn, Args, SourceLocation());
@ -824,7 +824,7 @@ GenerateDestroyHelperFunction(bool BlockHasCopyDispose,
FunctionDecl *FD = FunctionDecl::Create(getContext(),
getContext().getTranslationUnitDecl(),
SourceLocation(), II, R,
SourceLocation(), II, R, 0,
FunctionDecl::Static, false,
true);
CGF.StartFunction(FD, R, Fn, Args, SourceLocation());
@ -908,7 +908,7 @@ GeneratebyrefCopyHelperFunction(const llvm::Type *T, int flag) {
FunctionDecl *FD = FunctionDecl::Create(getContext(),
getContext().getTranslationUnitDecl(),
SourceLocation(), II, R,
SourceLocation(), II, R, 0,
FunctionDecl::Static, false,
true);
CGF.StartFunction(FD, R, Fn, Args, SourceLocation());
@ -972,7 +972,7 @@ BlockFunction::GeneratebyrefDestroyHelperFunction(const llvm::Type *T,
FunctionDecl *FD = FunctionDecl::Create(getContext(),
getContext().getTranslationUnitDecl(),
SourceLocation(), II, R,
SourceLocation(), II, R, 0,
FunctionDecl::Static, false,
true);
CGF.StartFunction(FD, R, Fn, Args, SourceLocation());

View File

@ -3555,9 +3555,9 @@ ObjCCommonTypesHelper::ObjCCommonTypesHelper(CodeGen::CodeGenModule &cgm)
SourceLocation(),
&Ctx.Idents.get("_objc_super"));
RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), 0,
Ctx.getObjCIdType(), 0, false));
Ctx.getObjCIdType(), 0, 0, false));
RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), 0,
Ctx.getObjCClassType(), 0, false));
Ctx.getObjCClassType(), 0, 0, false));
RD->completeDefinition(Ctx);
SuperCTy = Ctx.getTagDeclType(RD);
@ -4018,9 +4018,9 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul
SourceLocation(),
&Ctx.Idents.get("_message_ref_t"));
RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), 0,
Ctx.VoidPtrTy, 0, false));
Ctx.VoidPtrTy, 0, 0, false));
RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), 0,
Ctx.getObjCSelType(), 0, false));
Ctx.getObjCSelType(), 0, 0, false));
RD->completeDefinition(Ctx);
MessageRefCTy = Ctx.getTagDeclType(RD);

View File

@ -623,7 +623,7 @@ Decl *PCHReader::ReadDeclRecord(uint64_t Offset, unsigned Index) {
break;
case pch::DECL_FUNCTION:
D = FunctionDecl::Create(*Context, 0, SourceLocation(), DeclarationName(),
QualType());
QualType(), 0);
break;
case pch::DECL_OBJC_METHOD:
D = ObjCMethodDecl::Create(*Context, SourceLocation(), SourceLocation(),
@ -633,7 +633,7 @@ Decl *PCHReader::ReadDeclRecord(uint64_t Offset, unsigned Index) {
D = ObjCInterfaceDecl::Create(*Context, 0, SourceLocation(), 0);
break;
case pch::DECL_OBJC_IVAR:
D = ObjCIvarDecl::Create(*Context, 0, SourceLocation(), 0, QualType(),
D = ObjCIvarDecl::Create(*Context, 0, SourceLocation(), 0, QualType(), 0,
ObjCIvarDecl::None);
break;
case pch::DECL_OBJC_PROTOCOL:
@ -670,11 +670,11 @@ Decl *PCHReader::ReadDeclRecord(uint64_t Offset, unsigned Index) {
ObjCPropertyImplDecl::Dynamic, 0);
break;
case pch::DECL_FIELD:
D = FieldDecl::Create(*Context, 0, SourceLocation(), 0, QualType(), 0,
D = FieldDecl::Create(*Context, 0, SourceLocation(), 0, QualType(), 0, 0,
false, SourceLocation());
break;
case pch::DECL_VAR:
D = VarDecl::Create(*Context, 0, SourceLocation(), 0, QualType(),
D = VarDecl::Create(*Context, 0, SourceLocation(), 0, QualType(), 0,
VarDecl::None, SourceLocation());
break;
@ -683,12 +683,12 @@ Decl *PCHReader::ReadDeclRecord(uint64_t Offset, unsigned Index) {
break;
case pch::DECL_PARM_VAR:
D = ParmVarDecl::Create(*Context, 0, SourceLocation(), 0, QualType(),
D = ParmVarDecl::Create(*Context, 0, SourceLocation(), 0, QualType(), 0,
VarDecl::None, 0);
break;
case pch::DECL_ORIGINAL_PARM_VAR:
D = OriginalParmVarDecl::Create(*Context, 0, SourceLocation(), 0,
QualType(), QualType(), VarDecl::None, 0);
QualType(),0, QualType(), VarDecl::None, 0);
break;
case pch::DECL_FILE_SCOPE_ASM:
D = FileScopeAsmDecl::Create(*Context, 0, SourceLocation(), 0);

View File

@ -1945,7 +1945,7 @@ void RewriteObjC::SynthSelGetUidFunctionDecl() {
false /*isVariadic*/, 0);
SelGetUidFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
SourceLocation(),
SelGetUidIdent, getFuncType,
SelGetUidIdent, getFuncType, 0,
FunctionDecl::Extern, false);
}
@ -1974,7 +1974,7 @@ void RewriteObjC::SynthSuperContructorFunctionDecl() {
false, 0);
SuperContructorFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
SourceLocation(),
msgSendIdent, msgSendType,
msgSendIdent, msgSendType, 0,
FunctionDecl::Extern, false);
}
@ -1993,7 +1993,7 @@ void RewriteObjC::SynthMsgSendFunctionDecl() {
true /*isVariadic*/, 0);
MsgSendFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
SourceLocation(),
msgSendIdent, msgSendType,
msgSendIdent, msgSendType, 0,
FunctionDecl::Extern, false);
}
@ -2015,7 +2015,7 @@ void RewriteObjC::SynthMsgSendSuperFunctionDecl() {
true /*isVariadic*/, 0);
MsgSendSuperFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
SourceLocation(),
msgSendIdent, msgSendType,
msgSendIdent, msgSendType, 0,
FunctionDecl::Extern, false);
}
@ -2034,7 +2034,7 @@ void RewriteObjC::SynthMsgSendStretFunctionDecl() {
true /*isVariadic*/, 0);
MsgSendStretFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
SourceLocation(),
msgSendIdent, msgSendType,
msgSendIdent, msgSendType, 0,
FunctionDecl::Extern, false);
}
@ -2058,7 +2058,7 @@ void RewriteObjC::SynthMsgSendSuperStretFunctionDecl() {
true /*isVariadic*/, 0);
MsgSendSuperStretFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
SourceLocation(),
msgSendIdent, msgSendType,
msgSendIdent, msgSendType, 0,
FunctionDecl::Extern, false);
}
@ -2077,7 +2077,7 @@ void RewriteObjC::SynthMsgSendFpretFunctionDecl() {
true /*isVariadic*/, 0);
MsgSendFpretFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
SourceLocation(),
msgSendIdent, msgSendType,
msgSendIdent, msgSendType, 0,
FunctionDecl::Extern, false);
}
@ -2092,7 +2092,7 @@ void RewriteObjC::SynthGetClassFunctionDecl() {
false /*isVariadic*/, 0);
GetClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
SourceLocation(),
getClassIdent, getClassType,
getClassIdent, getClassType, 0,
FunctionDecl::Extern, false);
}
@ -2107,7 +2107,7 @@ void RewriteObjC::SynthGetMetaClassFunctionDecl() {
false /*isVariadic*/, 0);
GetMetaClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
SourceLocation(),
getClassIdent, getClassType,
getClassIdent, getClassType, 0,
FunctionDecl::Extern, false);
}
@ -2142,7 +2142,7 @@ Stmt *RewriteObjC::RewriteObjCStringLiteral(ObjCStringLiteral *Exp) {
Preamble += utostr(prettyBuf.str().size()-2) + "};\n";
VarDecl *NewVD = VarDecl::Create(*Context, TUDecl, SourceLocation(),
&Context->Idents.get(S.c_str()), strType,
&Context->Idents.get(S.c_str()), strType, 0,
VarDecl::Static);
DeclRefExpr *DRE = new (Context) DeclRefExpr(NewVD, strType, SourceLocation());
Expr *Unop = new (Context) UnaryOperator(DRE, UnaryOperator::AddrOf,
@ -2190,7 +2190,8 @@ QualType RewriteObjC::getSuperStructType() {
for (unsigned i = 0; i < 2; ++i) {
SuperStructDecl->addDecl(FieldDecl::Create(*Context, SuperStructDecl,
SourceLocation(), 0,
FieldTypes[i], /*BitWidth=*/0,
FieldTypes[i], 0,
/*BitWidth=*/0,
/*Mutable=*/false));
}
@ -2220,7 +2221,7 @@ QualType RewriteObjC::getConstantStringStructType() {
ConstantStringDecl->addDecl(FieldDecl::Create(*Context,
ConstantStringDecl,
SourceLocation(), 0,
FieldTypes[i],
FieldTypes[i], 0,
/*BitWidth=*/0,
/*Mutable=*/true));
}
@ -2626,7 +2627,7 @@ Stmt *RewriteObjC::RewriteObjCProtocolExpr(ObjCProtocolExpr *Exp) {
std::string Name = "_OBJC_PROTOCOL_" + Exp->getProtocol()->getNameAsString();
IdentifierInfo *ID = &Context->Idents.get(Name);
VarDecl *VD = VarDecl::Create(*Context, TUDecl, SourceLocation(),
ID, QualType()/*UNUSED*/, VarDecl::Extern);
ID, QualType()/*UNUSED*/, 0, VarDecl::Extern);
DeclRefExpr *DRE = new (Context) DeclRefExpr(VD, getProtocolType(), SourceLocation());
Expr *DerefExpr = new (Context) UnaryOperator(DRE, UnaryOperator::AddrOf,
Context->getPointerType(DRE->getType()),
@ -3962,7 +3963,7 @@ Stmt *RewriteObjC::SynthesizeBlockCall(CallExpr *Exp) {
//PE->dump();
FieldDecl *FD = FieldDecl::Create(*Context, 0, SourceLocation(),
&Context->Idents.get("FuncPtr"), Context->VoidPtrTy,
&Context->Idents.get("FuncPtr"), Context->VoidPtrTy, 0,
/*BitWidth=*/0, /*Mutable=*/true);
MemberExpr *ME = new (Context) MemberExpr(PE, true, FD, SourceLocation(),
FD->getType());
@ -4194,7 +4195,7 @@ FunctionDecl *RewriteObjC::SynthBlockInitFunctionDecl(const char *name) {
IdentifierInfo *ID = &Context->Idents.get(name);
QualType FType = Context->getFunctionNoProtoType(Context->VoidPtrTy);
return FunctionDecl::Create(*Context, TUDecl,SourceLocation(),
ID, FType, FunctionDecl::Extern, false,
ID, FType, 0, FunctionDecl::Extern, false,
false);
}

View File

@ -420,8 +420,9 @@ public:
DeclarationName Entity);
QualType BuildBlockPointerType(QualType T, unsigned Quals,
SourceLocation Loc, DeclarationName Entity);
QualType GetTypeForDeclarator(Declarator &D, Scope *S, unsigned Skip = 0,
TagDecl **OwnedDecl = 0);
QualType GetTypeForDeclarator(Declarator &D, Scope *S,
DeclaratorInfo **DInfo = 0,
unsigned Skip = 0, TagDecl **OwnedDecl = 0);
DeclarationName GetNameForDeclarator(Declarator &D);
bool CheckSpecifiedExceptionType(QualType T, const SourceRange &Range);
bool CheckDistantExceptionSpec(QualType T);
@ -473,16 +474,18 @@ public:
Scope *S);
void DiagnoseFunctionSpecifiers(Declarator& D);
NamedDecl* ActOnTypedefDeclarator(Scope* S, Declarator& D, DeclContext* DC,
QualType R, Decl* PrevDecl,
bool &Redeclaration);
QualType R, DeclaratorInfo *DInfo,
Decl* PrevDecl, bool &Redeclaration);
NamedDecl* ActOnVariableDeclarator(Scope* S, Declarator& D, DeclContext* DC,
QualType R, NamedDecl* PrevDecl,
QualType R, DeclaratorInfo *DInfo,
NamedDecl* PrevDecl,
MultiTemplateParamsArg TemplateParamLists,
bool &Redeclaration);
void CheckVariableDeclaration(VarDecl *NewVD, NamedDecl *PrevDecl,
bool &Redeclaration);
NamedDecl* ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
QualType R, NamedDecl* PrevDecl,
QualType R, DeclaratorInfo *DInfo,
NamedDecl* PrevDecl,
MultiTemplateParamsArg TemplateParamLists,
bool IsFunctionDefinition,
bool &Redeclaration);
@ -571,7 +574,8 @@ public:
Declarator &D, Expr *BitfieldWidth,
AccessSpecifier AS);
FieldDecl *CheckFieldDecl(DeclarationName Name, QualType T,
FieldDecl *CheckFieldDecl(DeclarationName Name, QualType T,
DeclaratorInfo *DInfo,
RecordDecl *Record, SourceLocation Loc,
bool Mutable, Expr *BitfieldWidth,
SourceLocation TSSL,
@ -1402,6 +1406,7 @@ public:
StmtArg SynchBody);
VarDecl *BuildExceptionDeclaration(Scope *S, QualType ExDeclType,
DeclaratorInfo *DInfo,
IdentifierInfo *Name,
SourceLocation Loc,
SourceRange Range);

View File

@ -480,7 +480,7 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned bid,
FunctionDecl *New = FunctionDecl::Create(Context,
Context.getTranslationUnitDecl(),
Loc, II, R,
Loc, II, R, /*DInfo=*/0,
FunctionDecl::Extern, false,
/*hasPrototype=*/true);
New->setImplicit();
@ -491,7 +491,8 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned bid,
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), VarDecl::None, 0));
FT->getArgType(i), /*DInfo=*/0,
VarDecl::None, 0));
New->setParams(Context, Params.data(), Params.size());
}
@ -790,8 +791,8 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) {
ParamType != ParamEnd; ++ParamType) {
ParmVarDecl *Param = ParmVarDecl::Create(Context, New,
SourceLocation(), 0,
*ParamType, VarDecl::None,
0);
*ParamType, /*DInfo=*/0,
VarDecl::None, 0);
Param->setImplicit();
Params.push_back(Param);
}
@ -1492,7 +1493,7 @@ Sema::DeclPtrTy Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS,
if (RecordDecl *OwningClass = dyn_cast<RecordDecl>(Owner)) {
Anon = FieldDecl::Create(Context, OwningClass, Record->getLocation(),
/*IdentifierInfo=*/0,
Context.getTypeDeclType(Record),
Context.getTypeDeclType(Record), /*DInfo=*/0,
/*BitWidth=*/0, /*Mutable=*/false,
DS.getSourceRange().getBegin());
Anon->setAccess(AS_public);
@ -1519,7 +1520,7 @@ Sema::DeclPtrTy Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS,
Anon = VarDecl::Create(Context, Owner, Record->getLocation(),
/*IdentifierInfo=*/0,
Context.getTypeDeclType(Record),
Context.getTypeDeclType(Record), /*DInfo=*/0,
SC, DS.getSourceRange().getBegin());
}
Anon->setImplicit();
@ -1664,7 +1665,8 @@ Sema::HandleDeclarator(Scope *S, Declarator &D,
NamedDecl *PrevDecl;
NamedDecl *New;
QualType R = GetTypeForDeclarator(D, S);
DeclaratorInfo *DInfo = 0;
QualType R = GetTypeForDeclarator(D, S, &DInfo);
// See if this is a redefinition of a variable in the same scope.
if (D.getCXXScopeSpec().isInvalid()) {
@ -1764,13 +1766,13 @@ Sema::HandleDeclarator(Scope *S, Declarator &D,
return DeclPtrTy();
}
New = ActOnTypedefDeclarator(S, D, DC, R, PrevDecl, Redeclaration);
New = ActOnTypedefDeclarator(S, D, DC, R, DInfo, PrevDecl, Redeclaration);
} else if (R->isFunctionType()) {
New = ActOnFunctionDeclarator(S, D, DC, R, PrevDecl,
New = ActOnFunctionDeclarator(S, D, DC, R, DInfo, PrevDecl,
move(TemplateParamLists),
IsFunctionDefinition, Redeclaration);
} else {
New = ActOnVariableDeclarator(S, D, DC, R, PrevDecl,
New = ActOnVariableDeclarator(S, D, DC, R, DInfo, PrevDecl,
move(TemplateParamLists),
Redeclaration);
}
@ -1886,7 +1888,8 @@ void Sema::DiagnoseFunctionSpecifiers(Declarator& D) {
NamedDecl*
Sema::ActOnTypedefDeclarator(Scope* S, Declarator& D, DeclContext* DC,
QualType R, Decl* PrevDecl, bool &Redeclaration) {
QualType R, DeclaratorInfo *DInfo,
Decl* PrevDecl, bool &Redeclaration) {
// Typedef declarators cannot be qualified (C++ [dcl.meaning]p1).
if (D.getCXXScopeSpec().isSet()) {
Diag(D.getIdentifierLoc(), diag::err_qualified_typedef_declarator)
@ -2028,7 +2031,8 @@ isOutOfScopePreviousDeclaration(NamedDecl *PrevDecl, DeclContext *DC,
NamedDecl*
Sema::ActOnVariableDeclarator(Scope* S, Declarator& D, DeclContext* DC,
QualType R,NamedDecl* PrevDecl,
QualType R, DeclaratorInfo *DInfo,
NamedDecl* PrevDecl,
MultiTemplateParamsArg TemplateParamLists,
bool &Redeclaration) {
DeclarationName Name = GetNameForDeclarator(D);
@ -2130,7 +2134,7 @@ Sema::ActOnVariableDeclarator(Scope* S, Declarator& D, DeclContext* DC,
}
NewVD = VarDecl::Create(Context, DC, D.getIdentifierLoc(),
II, R, SC,
II, R, DInfo, SC,
// FIXME: Move to DeclGroup...
D.getDeclSpec().getSourceRange().getBegin());
@ -2323,7 +2327,8 @@ void Sema::CheckVariableDeclaration(VarDecl *NewVD, NamedDecl *PrevDecl,
NamedDecl*
Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
QualType R, NamedDecl* PrevDecl,
QualType R, DeclaratorInfo *DInfo,
NamedDecl* PrevDecl,
MultiTemplateParamsArg TemplateParamLists,
bool IsFunctionDefinition, bool &Redeclaration) {
assert(R.getTypePtr()->isFunctionType());
@ -2401,7 +2406,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
isInline |= IsFunctionDefinition;
NewFD = FriendFunctionDecl::Create(Context, DC,
D.getIdentifierLoc(), Name, R,
D.getIdentifierLoc(), Name, R, DInfo,
isInline,
D.getDeclSpec().getFriendSpecLoc());
@ -2415,7 +2420,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
// Create the new declaration
NewFD = CXXConstructorDecl::Create(Context,
cast<CXXRecordDecl>(DC),
D.getIdentifierLoc(), Name, R,
D.getIdentifierLoc(), Name, R, DInfo,
isExplicit, isInline,
/*isImplicitlyDeclared=*/false);
} else if (D.getKind() == Declarator::DK_Destructor) {
@ -2436,7 +2441,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, SC, isInline,
Name, R, DInfo, SC, isInline,
/*hasPrototype=*/true,
// FIXME: Move to DeclGroup...
D.getDeclSpec().getSourceRange().getBegin());
@ -2451,7 +2456,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
CheckConversionDeclarator(D, R, SC);
NewFD = CXXConversionDecl::Create(Context, cast<CXXRecordDecl>(DC),
D.getIdentifierLoc(), Name, R,
D.getIdentifierLoc(), Name, R, DInfo,
isInline, isExplicit);
isVirtualOkay = true;
@ -2470,7 +2475,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
// This is a C++ method declaration.
NewFD = CXXMethodDecl::Create(Context, cast<CXXRecordDecl>(DC),
D.getIdentifierLoc(), Name, R,
D.getIdentifierLoc(), Name, R, DInfo,
(SC == FunctionDecl::Static), isInline);
isVirtualOkay = (SC != FunctionDecl::Static);
@ -2488,7 +2493,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
NewFD = FunctionDecl::Create(Context, DC,
D.getIdentifierLoc(),
Name, R, SC, isInline, HasPrototype,
Name, R, DInfo, SC, isInline, HasPrototype,
// FIXME: Move to DeclGroup...
D.getDeclSpec().getSourceRange().getBegin());
}
@ -2640,7 +2645,8 @@ 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, VarDecl::None, 0);
*AI, /*DInfo=*/0,
VarDecl::None, 0);
Param->setImplicit();
Params.push_back(Param);
}
@ -3380,8 +3386,10 @@ Sema::ActOnParamDeclarator(Scope *S, Declarator &D) {
if (getLangOptions().CPlusPlus)
CheckExtraCXXDefaultArguments(D);
DeclaratorInfo *DInfo = 0;
TagDecl *OwnedDecl = 0;
QualType parmDeclType = GetTypeForDeclarator(D, S, /*Skip=*/0, &OwnedDecl);
QualType parmDeclType = GetTypeForDeclarator(D, S, &DInfo, /*Skip=*/0,
&OwnedDecl);
if (getLangOptions().CPlusPlus && OwnedDecl && OwnedDecl->isDefinition()) {
// C++ [dcl.fct]p6:
@ -3426,11 +3434,11 @@ Sema::ActOnParamDeclarator(Scope *S, Declarator &D) {
if (T == parmDeclType) // parameter type did not need adjustment
New = ParmVarDecl::Create(Context, CurContext,
D.getIdentifierLoc(), II,
parmDeclType, StorageClass,
parmDeclType, DInfo, StorageClass,
0);
else // keep track of both the adjusted and unadjusted types
New = OriginalParmVarDecl::Create(Context, CurContext,
D.getIdentifierLoc(), II, T,
D.getIdentifierLoc(), II, T, DInfo,
parmDeclType, StorageClass, 0);
if (D.isInvalidType())
@ -4421,7 +4429,8 @@ FieldDecl *Sema::HandleField(Scope *S, RecordDecl *Record,
SourceLocation Loc = DeclStart;
if (II) Loc = D.getIdentifierLoc();
QualType T = GetTypeForDeclarator(D, S);
DeclaratorInfo *DInfo = 0;
QualType T = GetTypeForDeclarator(D, S, &DInfo);
if (getLangOptions().CPlusPlus)
CheckExtraCXXDefaultArguments(D);
@ -4446,7 +4455,7 @@ FieldDecl *Sema::HandleField(Scope *S, RecordDecl *Record,
= (D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_mutable);
SourceLocation TSSL = D.getSourceRange().getBegin();
FieldDecl *NewFD
= CheckFieldDecl(II, T, Record, Loc, Mutable, BitWidth, TSSL,
= CheckFieldDecl(II, T, DInfo, Record, Loc, Mutable, BitWidth, TSSL,
AS, PrevDecl, &D);
if (NewFD->isInvalidDecl() && PrevDecl) {
// Don't introduce NewFD into scope; there's already something
@ -4469,7 +4478,8 @@ FieldDecl *Sema::HandleField(Scope *S, RecordDecl *Record,
/// \returns a new FieldDecl.
///
/// \todo The Declarator argument is a hack. It will be removed once
FieldDecl *Sema::CheckFieldDecl(DeclarationName Name, QualType T,
FieldDecl *Sema::CheckFieldDecl(DeclarationName Name, QualType T,
DeclaratorInfo *DInfo,
RecordDecl *Record, SourceLocation Loc,
bool Mutable, Expr *BitWidth,
SourceLocation TSSL,
@ -4518,8 +4528,8 @@ FieldDecl *Sema::CheckFieldDecl(DeclarationName Name, QualType T,
ZeroWidth = false;
}
FieldDecl *NewFD = FieldDecl::Create(Context, Record, Loc, II, T, BitWidth,
Mutable, TSSL);
FieldDecl *NewFD = FieldDecl::Create(Context, Record, Loc, II, T, DInfo,
BitWidth, Mutable, TSSL);
if (InvalidDecl)
NewFD->setInvalidDecl();
@ -4763,7 +4773,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!
QualType T = GetTypeForDeclarator(D, S);
DeclaratorInfo *DInfo = 0;
QualType T = GetTypeForDeclarator(D, S, &DInfo);
if (BitWidth) {
// 6.7.2.1p3, 6.7.2.1p4
@ -4805,8 +4816,8 @@ Sema::DeclPtrTy Sema::ActOnIvar(Scope *S,
// Construct the decl.
ObjCIvarDecl *NewID = ObjCIvarDecl::Create(Context,
EnclosingContext, Loc, II, T,ac,
(Expr *)BitfieldWidth);
EnclosingContext, Loc, II, T,
DInfo, ac, (Expr *)BitfieldWidth);
if (II) {
NamedDecl *PrevDecl = LookupName(S, II, LookupMemberName, true);

View File

@ -1863,11 +1863,12 @@ NamedDecl * Sema::DeclClonePragmaWeak(NamedDecl *ND, IdentifierInfo *II)
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) {
NewD = FunctionDecl::Create(FD->getASTContext(), FD->getDeclContext(),
FD->getLocation(), DeclarationName(II),
FD->getType());
FD->getType(), FD->getDeclaratorInfo());
} else if (VarDecl *VD = dyn_cast<VarDecl>(ND)) {
NewD = VarDecl::Create(VD->getASTContext(), VD->getDeclContext(),
VD->getLocation(), II,
VD->getType(), VD->getStorageClass());
VD->getType(), VD->getDeclaratorInfo(),
VD->getStorageClass());
}
return NewD;
}

View File

@ -1296,6 +1296,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
ClassDecl->getLocation(), Name,
Context.getFunctionType(Context.VoidTy,
0, 0, false, 0),
/*DInfo=*/0,
/*isExplicit=*/false,
/*isInline=*/true,
/*isImplicitlyDeclared=*/true);
@ -1367,6 +1368,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
Context.getFunctionType(Context.VoidTy,
&ArgType, 1,
false, 0),
/*DInfo=*/0,
/*isExplicit=*/false,
/*isInline=*/true,
/*isImplicitlyDeclared=*/true);
@ -1378,7 +1380,8 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
ParmVarDecl *FromParam = ParmVarDecl::Create(Context, CopyConstructor,
ClassDecl->getLocation(),
/*IdentifierInfo=*/0,
ArgType, VarDecl::None, 0);
ArgType, /*DInfo=*/0,
VarDecl::None, 0);
CopyConstructor->setParams(Context, &FromParam, 1);
ClassDecl->addDecl(CopyConstructor);
}
@ -1449,7 +1452,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
CXXMethodDecl::Create(Context, ClassDecl, ClassDecl->getLocation(), Name,
Context.getFunctionType(RetType, &ArgType, 1,
false, 0),
/*isStatic=*/false, /*isInline=*/true);
/*DInfo=*/0, /*isStatic=*/false, /*isInline=*/true);
CopyAssignment->setAccess(AS_public);
CopyAssignment->setImplicit();
CopyAssignment->setTrivial(ClassDecl->hasTrivialCopyAssignment());
@ -1459,7 +1462,8 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
ParmVarDecl *FromParam = ParmVarDecl::Create(Context, CopyAssignment,
ClassDecl->getLocation(),
/*IdentifierInfo=*/0,
ArgType, VarDecl::None, 0);
ArgType, /*DInfo=*/0,
VarDecl::None, 0);
CopyAssignment->setParams(Context, &FromParam, 1);
// Don't call addedAssignmentOperator. There is no way to distinguish an
@ -3217,6 +3221,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,
IdentifierInfo *Name,
SourceLocation Loc,
SourceRange Range) {
@ -3266,7 +3271,7 @@ VarDecl *Sema::BuildExceptionDeclaration(Scope *S, QualType ExDeclType,
// FIXME: Need to check for abstract classes.
VarDecl *ExDecl = VarDecl::Create(Context, CurContext, Loc,
Name, ExDeclType, VarDecl::None,
Name, ExDeclType, DInfo, VarDecl::None,
Range.getBegin());
if (Invalid)
@ -3278,7 +3283,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) {
QualType ExDeclType = GetTypeForDeclarator(D, S);
DeclaratorInfo *DInfo = 0;
QualType ExDeclType = GetTypeForDeclarator(D, S, &DInfo);
bool Invalid = D.isInvalidType();
IdentifierInfo *II = D.getIdentifier();
@ -3298,7 +3304,7 @@ Sema::DeclPtrTy Sema::ActOnExceptionDeclarator(Scope *S, Declarator &D) {
Invalid = true;
}
VarDecl *ExDecl = BuildExceptionDeclaration(S, ExDeclType,
VarDecl *ExDecl = BuildExceptionDeclaration(S, ExDeclType, DInfo,
D.getIdentifier(),
D.getIdentifierLoc(),
D.getDeclSpec().getSourceRange());
@ -3456,7 +3462,8 @@ Sema::DeclPtrTy Sema::ActOnFriendDecl(Scope *S,
assert(D);
SourceLocation Loc = D->getIdentifierLoc();
QualType T = GetTypeForDeclarator(*D, S);
DeclaratorInfo *DInfo = 0;
QualType T = GetTypeForDeclarator(*D, S, &DInfo);
// C++ [class.friend]p1
// A friend of a class is a function or class....
@ -3583,7 +3590,7 @@ Sema::DeclPtrTy Sema::ActOnFriendDecl(Scope *S,
}
}
NamedDecl *ND = ActOnFunctionDeclarator(S, *D, DC, T,
NamedDecl *ND = ActOnFunctionDeclarator(S, *D, DC, T, DInfo,
/* PrevDecl = */ FD,
MultiTemplateParamsArg(*this),
IsDefinition,

View File

@ -1431,6 +1431,7 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property,
property->getLocation(),
property->getIdentifier(),
property->getType(),
/*DInfo=*/0,
VarDecl::None,
0);
SetterMethod->setMethodParams(Context, &Argument, 1);
@ -1705,11 +1706,13 @@ Sema::DeclPtrTy Sema::ActOnMethodDeclaration(
if (ArgType == UnpromotedArgType)
Param = ParmVarDecl::Create(Context, ObjCMethod, ArgInfo[i].NameLoc,
ArgInfo[i].Name, ArgType,
/*DInfo=*/0, //FIXME: Pass info here.
VarDecl::None, 0);
else
Param = OriginalParmVarDecl::Create(Context, ObjCMethod,
ArgInfo[i].NameLoc,
ArgInfo[i].Name, ArgType,
/*DInfo=*/0, //FIXME: Pass info here.
UnpromotedArgType,
VarDecl::None, 0);
@ -2079,7 +2082,7 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc,
assert(EnclosingContext &&
"null DeclContext for synthesized ivar - ActOnPropertyImplDecl");
Ivar = ObjCIvarDecl::Create(Context, EnclosingContext, PropertyLoc,
PropertyIvar, PropType,
PropertyIvar, PropType, /*Dinfo=*/0,
ObjCIvarDecl::Public,
(Expr *)0);
Ivar->setLexicalDeclContext(IDecl);

View File

@ -302,7 +302,9 @@ Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
Skip = 1;
}
QualType AllocType = GetTypeForDeclarator(D, /*Scope=*/0, Skip);
//FIXME: Store DeclaratorInfo in CXXNew expression.
DeclaratorInfo *DInfo = 0;
QualType AllocType = GetTypeForDeclarator(D, /*Scope=*/0, &DInfo, Skip);
if (D.isInvalidType())
return ExprError();
@ -668,11 +670,12 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name,
QualType FnType = Context.getFunctionType(Return, &Argument, 1, false, 0);
FunctionDecl *Alloc =
FunctionDecl::Create(Context, GlobalCtx, SourceLocation(), Name,
FnType, FunctionDecl::None, false, true,
FnType, /*DInfo=*/0, FunctionDecl::None, false, true,
SourceLocation());
Alloc->setImplicit();
ParmVarDecl *Param = ParmVarDecl::Create(Context, Alloc, SourceLocation(),
0, Argument, VarDecl::None, 0);
0, Argument, /*DInfo=*/0,
VarDecl::None, 0);
Alloc->setParams(Context, &Param, 1);
// FIXME: Also add this declaration to the IdentifierResolver, but
@ -778,8 +781,10 @@ Sema::ActOnCXXConditionDeclarationExpr(Scope *S, SourceLocation StartLoc,
assert(D.getDeclSpec().getStorageClassSpec() != DeclSpec::SCS_typedef &&
"Parser allowed 'typedef' as storage class of condition decl.");
// FIXME: Store DeclaratorInfo in the expression.
DeclaratorInfo *DInfo = 0;
TagDecl *OwnedTag = 0;
QualType Ty = GetTypeForDeclarator(D, S, /*Skip=*/0, &OwnedTag);
QualType Ty = GetTypeForDeclarator(D, S, &DInfo, /*Skip=*/0, &OwnedTag);
if (Ty->isFunctionType()) { // The declarator shall not specify a function...
// We exit without creating a CXXConditionDeclExpr because a FunctionDecl

View File

@ -289,7 +289,8 @@ Sema::CheckNonTypeTemplateParameterType(QualType T, SourceLocation Loc) {
Sema::DeclPtrTy Sema::ActOnNonTypeTemplateParameter(Scope *S, Declarator &D,
unsigned Depth,
unsigned Position) {
QualType T = GetTypeForDeclarator(D, S);
DeclaratorInfo *DInfo = 0;
QualType T = GetTypeForDeclarator(D, S, &DInfo);
assert(S->isTemplateParamScope() &&
"Non-type template parameter not in template parameter scope!");
@ -311,7 +312,7 @@ Sema::DeclPtrTy Sema::ActOnNonTypeTemplateParameter(Scope *S, Declarator &D,
NonTypeTemplateParmDecl *Param
= NonTypeTemplateParmDecl::Create(Context, CurContext, D.getIdentifierLoc(),
Depth, Position, ParamName, T);
Depth, Position, ParamName, T, DInfo);
if (Invalid)
Param->setInvalidDecl();

View File

@ -119,8 +119,8 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D) {
// Build the instantiated declaration
VarDecl *Var = VarDecl::Create(SemaRef.Context, Owner,
D->getLocation(), D->getIdentifier(),
T, D->getStorageClass(),
D->getTypeSpecStartLoc());
T, D->getDeclaratorInfo(),
D->getStorageClass(),D->getTypeSpecStartLoc());
Var->setThreadSpecified(D->isThreadSpecified());
Var->setCXXDirectInitializer(D->hasCXXDirectInitializer());
Var->setDeclaredInCondition(D->isDeclaredInCondition());
@ -199,6 +199,7 @@ Decl *TemplateDeclInstantiator::VisitFieldDecl(FieldDecl *D) {
}
FieldDecl *Field = SemaRef.CheckFieldDecl(D->getDeclName(), T,
D->getDeclaratorInfo(),
cast<RecordDecl>(Owner),
D->getLocation(),
D->isMutable(),
@ -380,13 +381,14 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D) {
Function =
FriendFunctionDecl::Create(SemaRef.Context, DC, D->getLocation(),
D->getDeclName(), T, D->isInline(),
FFD->getFriendLoc());
D->getDeclName(), T, D->getDeclaratorInfo(),
D->isInline(), FFD->getFriendLoc());
Function->setLexicalDeclContext(Owner);
} else {
Function =
FunctionDecl::Create(SemaRef.Context, Owner, D->getLocation(),
D->getDeclName(), T, D->getStorageClass(),
D->getDeclName(), T, D->getDeclaratorInfo(),
D->getStorageClass(),
D->isInline(), D->hasWrittenPrototype(),
D->getTypeSpecStartLoc());
}
@ -440,8 +442,8 @@ Decl *TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D) {
CXXRecordDecl *Record = cast<CXXRecordDecl>(Owner);
CXXMethodDecl *Method
= CXXMethodDecl::Create(SemaRef.Context, Record, D->getLocation(),
D->getDeclName(), T, D->isStatic(),
D->isInline());
D->getDeclName(), T, D->getDeclaratorInfo(),
D->isStatic(), D->isInline());
Method->setInstantiationOfMemberFunction(D);
// If we are instantiating a member function defined
@ -494,8 +496,8 @@ Decl *TemplateDeclInstantiator::VisitCXXConstructorDecl(CXXConstructorDecl *D) {
SemaRef.Context.getCanonicalType(ClassTy));
CXXConstructorDecl *Constructor
= CXXConstructorDecl::Create(SemaRef.Context, Record, D->getLocation(),
Name, T, D->isExplicit(), D->isInline(),
false);
Name, T, D->getDeclaratorInfo(),
D->isExplicit(), D->isInline(), false);
Constructor->setInstantiationOfMemberFunction(D);
// Attach the parameters
@ -576,7 +578,8 @@ Decl *TemplateDeclInstantiator::VisitCXXConversionDecl(CXXConversionDecl *D) {
= CXXConversionDecl::Create(SemaRef.Context, Record,
D->getLocation(),
SemaRef.Context.DeclarationNames.getCXXConversionFunctionName(ConvTy),
T, D->isInline(), D->isExplicit());
T, D->getDeclaratorInfo(),
D->isInline(), D->isExplicit());
Conversion->setInstantiationOfMemberFunction(D);
if (InitMethodInstantiation(Conversion, D))
Conversion->setInvalidDecl();
@ -612,12 +615,13 @@ ParmVarDecl *TemplateDeclInstantiator::VisitParmVarDecl(ParmVarDecl *D) {
ParmVarDecl *Param = 0;
if (T == OrigT)
Param = ParmVarDecl::Create(SemaRef.Context, Owner, D->getLocation(),
D->getIdentifier(), T, D->getStorageClass(),
0);
D->getIdentifier(), T, D->getDeclaratorInfo(),
D->getStorageClass(), 0);
else
Param = OriginalParmVarDecl::Create(SemaRef.Context, Owner,
D->getLocation(), D->getIdentifier(),
T, OrigT, D->getStorageClass(), 0);
T, D->getDeclaratorInfo(), OrigT,
D->getStorageClass(), 0);
// Note: we don't try to instantiate function parameters until after
// we've instantiated the function's type. Therefore, we don't have

View File

@ -337,6 +337,7 @@ TemplateStmtInstantiator::VisitCXXCatchStmt(CXXCatchStmt *S) {
return SemaRef.StmtError();
Var = SemaRef.BuildExceptionDeclaration(0, T,
ExceptionDecl->getDeclaratorInfo(),
ExceptionDecl->getIdentifier(),
ExceptionDecl->getLocation(),
/*FIXME: Inaccurate*/

View File

@ -783,7 +783,8 @@ QualType Sema::BuildBlockPointerType(QualType T, unsigned Quals,
/// If OwnedDecl is non-NULL, and this declarator's decl-specifier-seq
/// 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, unsigned Skip,
QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S,
DeclaratorInfo **DInfo, unsigned Skip,
TagDecl **OwnedDecl) {
bool OmittedReturnType = false;
@ -1416,8 +1417,9 @@ Sema::TypeResult Sema::ActOnTypeName(Scope *S, Declarator &D) {
// the parser.
assert(D.getIdentifier() == 0 && "Type name should have no identifier!");
DeclaratorInfo *DInfo = 0;
TagDecl *OwnedTag = 0;
QualType T = GetTypeForDeclarator(D, S, /*Skip=*/0, &OwnedTag);
QualType T = GetTypeForDeclarator(D, S, &DInfo, /*Skip=*/0, &OwnedTag);
if (D.isInvalidType())
return true;
@ -1434,6 +1436,7 @@ Sema::TypeResult Sema::ActOnTypeName(Scope *S, Declarator &D) {
<< Context.getTypeDeclType(OwnedTag);
}
//FIXME: Also pass DeclaratorInfo.
return T.getAsOpaquePtr();
}