diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-07-21 14:46:17 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-07-21 14:46:17 +0000 |
commit | 741dd9a7e1d63e4e385b657e4ce11c5d96d44f72 (patch) | |
tree | 7e76dc2575d0e1c72a1dc6f311009aeeaae191ba /lib/Sema/SemaDecl.cpp | |
parent | 98f2cca4b2731b5d43da7c1582dd443ecead658d (diff) |
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
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 2d7d469098..36cb656966 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -3711,7 +3711,7 @@ CreateNewDecl: if (Kind == TagDecl::TK_enum) { // FIXME: Tag decls should be chained to any simultaneous vardecls, e.g.: // enum X { A, B, C } D; D should chain to X. - New = EnumDecl::Create(Context, SearchDC, Loc, Name, + New = EnumDecl::Create(Context, SearchDC, Loc, Name, KWLoc, cast_or_null<EnumDecl>(PrevDecl)); // If this is an undefined enum, warn. if (TK != TK_Definition && !Invalid) { @@ -3726,10 +3726,10 @@ CreateNewDecl: // struct X { int A; } D; D should chain to X. if (getLangOptions().CPlusPlus) // FIXME: Look for a way to use RecordDecl for simple structs. - New = CXXRecordDecl::Create(Context, Kind, SearchDC, Loc, Name, + New = CXXRecordDecl::Create(Context, Kind, SearchDC, Loc, Name, KWLoc, cast_or_null<CXXRecordDecl>(PrevDecl)); else - New = RecordDecl::Create(Context, Kind, SearchDC, Loc, Name, + New = RecordDecl::Create(Context, Kind, SearchDC, Loc, Name, KWLoc, cast_or_null<RecordDecl>(PrevDecl)); } @@ -3831,7 +3831,9 @@ void Sema::ActOnTagStartDefinition(Scope *S, DeclPtrTy TagD) { CXXRecordDecl *InjectedClassName = CXXRecordDecl::Create(Context, Record->getTagKind(), CurContext, Record->getLocation(), - Record->getIdentifier(), Record); + Record->getIdentifier(), + Record->getTagKeywordLoc(), + Record); InjectedClassName->setImplicit(); InjectedClassName->setAccess(AS_public); if (ClassTemplateDecl *Template = Record->getDescribedClassTemplate()) |