forked from OSchip/llvm-project
parent
427f570ce1
commit
16f7e554a1
|
@ -3997,12 +3997,10 @@ static bool CheckAnonMemberRedeclaration(Sema &SemaRef,
|
||||||
///
|
///
|
||||||
/// This routine is recursive, injecting the names of nested anonymous
|
/// This routine is recursive, injecting the names of nested anonymous
|
||||||
/// structs/unions into the owning context and scope as well.
|
/// structs/unions into the owning context and scope as well.
|
||||||
static bool InjectAnonymousStructOrUnionMembers(Sema &SemaRef, Scope *S,
|
static bool
|
||||||
DeclContext *Owner,
|
InjectAnonymousStructOrUnionMembers(Sema &SemaRef, Scope *S, DeclContext *Owner,
|
||||||
RecordDecl *AnonRecord,
|
RecordDecl *AnonRecord, AccessSpecifier AS,
|
||||||
AccessSpecifier AS,
|
SmallVectorImpl<NamedDecl *> &Chaining) {
|
||||||
SmallVectorImpl<NamedDecl *> &Chaining,
|
|
||||||
bool MSAnonStruct) {
|
|
||||||
bool Invalid = false;
|
bool Invalid = false;
|
||||||
|
|
||||||
// Look every FieldDecl and IndirectFieldDecl with a name.
|
// Look every FieldDecl and IndirectFieldDecl with a name.
|
||||||
|
@ -4345,8 +4343,7 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS,
|
||||||
SmallVector<NamedDecl*, 2> Chain;
|
SmallVector<NamedDecl*, 2> Chain;
|
||||||
Chain.push_back(Anon);
|
Chain.push_back(Anon);
|
||||||
|
|
||||||
if (InjectAnonymousStructOrUnionMembers(*this, S, Owner, Record, AS,
|
if (InjectAnonymousStructOrUnionMembers(*this, S, Owner, Record, AS, Chain))
|
||||||
Chain, false))
|
|
||||||
Invalid = true;
|
Invalid = true;
|
||||||
|
|
||||||
if (VarDecl *NewVD = dyn_cast<VarDecl>(Anon)) {
|
if (VarDecl *NewVD = dyn_cast<VarDecl>(Anon)) {
|
||||||
|
@ -4418,7 +4415,7 @@ Decl *Sema::BuildMicrosoftCAnonymousStruct(Scope *S, DeclSpec &DS,
|
||||||
if (RequireCompleteType(Anon->getLocation(), RecTy,
|
if (RequireCompleteType(Anon->getLocation(), RecTy,
|
||||||
diag::err_field_incomplete) ||
|
diag::err_field_incomplete) ||
|
||||||
InjectAnonymousStructOrUnionMembers(*this, S, CurContext, RecordDef,
|
InjectAnonymousStructOrUnionMembers(*this, S, CurContext, RecordDef,
|
||||||
AS_none, Chain, true)) {
|
AS_none, Chain)) {
|
||||||
Anon->setInvalidDecl();
|
Anon->setInvalidDecl();
|
||||||
ParentDecl->setInvalidDecl();
|
ParentDecl->setInvalidDecl();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue