summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2009-07-14 14:58:18 +0000
committerSteve Naroff <snaroff@apple.com>2009-07-14 14:58:18 +0000
commit5ec6ff7678d04b1d972b0ccc8a0323898ec3ff04 (patch)
tree6a53df84e30816c0e2a430acbc53a8b578cfb531 /clang/lib/Sema/SemaDecl.cpp
parentf34f8634e7584e8f3fa6d62915567fb5487cd826 (diff)
downloadbcm5719-llvm-5ec6ff7678d04b1d972b0ccc8a0323898ec3ff04.tar.gz
bcm5719-llvm-5ec6ff7678d04b1d972b0ccc8a0323898ec3ff04.zip
Add a "TypeSpecStartLoc" to FieldDecl. Patch contributed by Enea Zaffanella.
Note: One day, it might be useful to consider adding this info to DeclGroup (as the comments in FunctionDecl/VarDecl suggest). For now, I think this works fine. I considered moving this to ValueDecl (a common ancestor of FunctionDecl/VarDecl/FieldDecl), however this would add overhead to EnumConstantDecl (which would burn memory and isn't necessary). llvm-svn: 75635
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index c1dcdd6ec03..d069fb06b98 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -1268,7 +1268,8 @@ Sema::DeclPtrTy Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS,
Anon = FieldDecl::Create(Context, OwningClass, Record->getLocation(),
/*IdentifierInfo=*/0,
Context.getTypeDeclType(Record),
- /*BitWidth=*/0, /*Mutable=*/false);
+ /*BitWidth=*/0, /*Mutable=*/false,
+ DS.getSourceRange().getBegin());
Anon->setAccess(AS_public);
if (getLangOptions().CPlusPlus)
FieldCollector->Add(cast<FieldDecl>(Anon));
@@ -3947,10 +3948,12 @@ FieldDecl *Sema::HandleField(Scope *S, RecordDecl *Record,
if (PrevDecl && !isDeclInScope(PrevDecl, Record, S))
PrevDecl = 0;
- FieldDecl *NewFD
- = CheckFieldDecl(II, T, Record, Loc,
- D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_mutable,
- BitWidth, AS, PrevDecl, &D);
+ bool Mutable
+ = (D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_mutable);
+ SourceLocation TSSL = D.getSourceRange().getBegin();
+ FieldDecl *NewFD
+ = CheckFieldDecl(II, T, Record, Loc, Mutable, BitWidth, TSSL,
+ AS, PrevDecl, &D);
if (NewFD->isInvalidDecl() && PrevDecl) {
// Don't introduce NewFD into scope; there's already something
// with the same name in the same scope.
@@ -3975,6 +3978,7 @@ FieldDecl *Sema::HandleField(Scope *S, RecordDecl *Record,
FieldDecl *Sema::CheckFieldDecl(DeclarationName Name, QualType T,
RecordDecl *Record, SourceLocation Loc,
bool Mutable, Expr *BitWidth,
+ SourceLocation TSSL,
AccessSpecifier AS, NamedDecl *PrevDecl,
Declarator *D) {
IdentifierInfo *II = Name.getAsIdentifierInfo();
@@ -4020,7 +4024,7 @@ FieldDecl *Sema::CheckFieldDecl(DeclarationName Name, QualType T,
}
FieldDecl *NewFD = FieldDecl::Create(Context, Record, Loc, II, T, BitWidth,
- Mutable);
+ Mutable, TSSL);
if (InvalidDecl)
NewFD->setInvalidDecl();
OpenPOWER on IntegriCloud