Add the location of the tag keyword into TagDecl. From Enea
Zaffanella, with tweaks from Abramo Bagnara.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76576 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 6b1f830..b4710c2 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -182,9 +182,9 @@
}
EnumDecl *EnumDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,
- IdentifierInfo *Id,
+ IdentifierInfo *Id, SourceLocation TKL,
EnumDecl *PrevDecl) {
- EnumDecl *Enum = new (C) EnumDecl(DC, L, Id);
+ EnumDecl *Enum = new (C) EnumDecl(DC, L, Id, TKL);
C.getTypeDeclType(Enum, PrevDecl);
return Enum;
}
@@ -654,7 +654,7 @@
SourceRange TagDecl::getSourceRange() const {
SourceLocation E = RBraceLoc.isValid() ? RBraceLoc : getLocation();
- return SourceRange(getLocation(), E);
+ return SourceRange(TagKeywordLoc, E);
}
TagDecl* TagDecl::getCanonicalDecl() {
@@ -692,8 +692,8 @@
//===----------------------------------------------------------------------===//
RecordDecl::RecordDecl(Kind DK, TagKind TK, DeclContext *DC, SourceLocation L,
- IdentifierInfo *Id)
- : TagDecl(DK, TK, DC, L, Id) {
+ IdentifierInfo *Id, SourceLocation TKL)
+ : TagDecl(DK, TK, DC, L, Id, TKL) {
HasFlexibleArrayMember = false;
AnonymousStructOrUnion = false;
HasObjectMember = false;
@@ -702,9 +702,9 @@
RecordDecl *RecordDecl::Create(ASTContext &C, TagKind TK, DeclContext *DC,
SourceLocation L, IdentifierInfo *Id,
- RecordDecl* PrevDecl) {
+ SourceLocation TKL, RecordDecl* PrevDecl) {
- RecordDecl* R = new (C) RecordDecl(Record, TK, DC, L, Id);
+ RecordDecl* R = new (C) RecordDecl(Record, TK, DC, L, Id, TKL);
C.getTypeDeclType(R, PrevDecl);
return R;
}