forked from OSchip/llvm-project
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:
parent
12fdb9e34b
commit
969c5bd2d8
|
@ -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())) {
|
||||
|
|
Loading…
Reference in New Issue