In the ASTImporter, when checking whether two

structs are compatible, check whether the fields
of the structs have the same name.  This prevents
erroneous coalescing of (in particular) anonymous
structs.

llvm-svn: 180644
This commit is contained in:
Sean Callanan 2013-04-26 22:49:25 +00:00
parent 12fdb9e34b
commit 969c5bd2d8
1 changed files with 6 additions and 0 deletions

View File

@ -839,6 +839,12 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
RecordDecl *D2 = Field2->getType()->castAs<RecordType>()->getDecl();
return IsStructurallyEquivalent(Context, D1, D2);
}
// Check for equivalent field names.
IdentifierInfo *Name1 = Field1->getIdentifier();
IdentifierInfo *Name2 = Field2->getIdentifier();
if (!::IsStructurallyEquivalent(Name1, Name2))
return false;
if (!IsStructurallyEquivalent(Context,
Field1->getType(), Field2->getType())) {