Remove TypeSpecStartLocation from VarDecl/FunctionDecl/FieldDecl, and use DeclaratorInfo to get this information.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79584 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index b41fae8..fc19e61 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -140,11 +140,9 @@
DeclarationName N, QualType T,
DeclaratorInfo *DInfo,
StorageClass S, bool isInline,
- bool hasWrittenPrototype,
- SourceLocation TypeSpecStartLoc) {
+ bool hasWrittenPrototype) {
FunctionDecl *New
- = new (C) FunctionDecl(Function, DC, L, N, T, DInfo, S, isInline,
- TypeSpecStartLoc);
+ = new (C) FunctionDecl(Function, DC, L, N, T, DInfo, S, isInline);
New->HasWrittenPrototype = hasWrittenPrototype;
return New;
}
@@ -155,9 +153,8 @@
FieldDecl *FieldDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,
IdentifierInfo *Id, QualType T,
- DeclaratorInfo *DInfo, Expr *BW,
- bool Mutable, SourceLocation TSSL) {
- return new (C) FieldDecl(Decl::Field, DC, L, Id, T, DInfo, BW, Mutable, TSSL);
+ DeclaratorInfo *DInfo, Expr *BW, bool Mutable) {
+ return new (C) FieldDecl(Decl::Field, DC, L, Id, T, DInfo, BW, Mutable);
}
bool FieldDecl::isAnonymousStructOrUnion() const {
@@ -317,13 +314,23 @@
}
//===----------------------------------------------------------------------===//
+// DeclaratorDecl Implementation
+//===----------------------------------------------------------------------===//
+
+SourceLocation DeclaratorDecl::getTypeSpecStartLoc() const {
+ if (DeclInfo)
+ return DeclInfo->getTypeLoc().getTypeSpecRange().getBegin();
+ return SourceLocation();
+}
+
+//===----------------------------------------------------------------------===//
// VarDecl Implementation
//===----------------------------------------------------------------------===//
VarDecl *VarDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,
IdentifierInfo *Id, QualType T, DeclaratorInfo *DInfo,
- StorageClass S, SourceLocation TypeSpecStartLoc) {
- return new (C) VarDecl(Var, DC, L, Id, T, DInfo, S, TypeSpecStartLoc);
+ StorageClass S) {
+ return new (C) VarDecl(Var, DC, L, Id, T, DInfo, S);
}
void VarDecl::Destroy(ASTContext& C) {
diff --git a/lib/AST/DeclTemplate.cpp b/lib/AST/DeclTemplate.cpp
index c132749..08e53eb 100644
--- a/lib/AST/DeclTemplate.cpp
+++ b/lib/AST/DeclTemplate.cpp
@@ -236,10 +236,8 @@
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, DInfo,
- TypeSpecStartLoc);
+ DeclaratorInfo *DInfo) {
+ return new (C) NonTypeTemplateParmDecl(DC, L, D, P, Id, T, DInfo);
}
SourceLocation NonTypeTemplateParmDecl::getDefaultArgumentLoc() const {