diff options
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/Sema.h | 1 | ||||
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 16 | ||||
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 1 |
3 files changed, 12 insertions, 6 deletions
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index 8445660816..4344fde676 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -541,6 +541,7 @@ public: FieldDecl *CheckFieldDecl(DeclarationName Name, QualType T, RecordDecl *Record, SourceLocation Loc, bool Mutable, Expr *BitfieldWidth, + SourceLocation TSSL, AccessSpecifier AS, NamedDecl *PrevDecl, Declarator *D = 0); diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index c1dcdd6ec0..d069fb06b9 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/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(); diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index f597199920..1f58568580 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -182,6 +182,7 @@ Decl *TemplateDeclInstantiator::VisitFieldDecl(FieldDecl *D) { D->getLocation(), D->isMutable(), BitWidth, + D->getTypeSpecStartLoc(), D->getAccess(), 0); if (Field) { |