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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79392 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index 69ff792..063bb2a 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -2549,7 +2549,8 @@
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 @@
FieldDecl *Field = FieldDecl::Create(*this,
ObjCFastEnumerationStateTypeDecl,
SourceLocation(), 0,
- FieldTypes[i], /*BitWidth=*/0,
+ FieldTypes[i], /*DInfo=*/0,
+ /*BitWidth=*/0,
/*Mutable=*/false);
ObjCFastEnumerationStateTypeDecl->addDecl(Field);
}
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index f5acb2c..b41fae8 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -84,9 +84,9 @@
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 @@
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 @@
}
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 @@
//===----------------------------------------------------------------------===//
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) {
diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp
index 559d942..c00d361 100644
--- a/lib/AST/DeclCXX.cpp
+++ b/lib/AST/DeclCXX.cpp
@@ -321,8 +321,10 @@
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 @@
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 @@
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 @@
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,
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index e99dd60..8338c48 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -449,8 +449,9 @@
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);
}
diff --git a/lib/AST/DeclTemplate.cpp b/lib/AST/DeclTemplate.cpp
index f5f7bfe..c132749 100644
--- a/lib/AST/DeclTemplate.cpp
+++ b/lib/AST/DeclTemplate.cpp
@@ -236,8 +236,9 @@
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);
}