From: Sean Callanan Date: Fri, 26 Apr 2013 22:49:25 +0000 (+0000) Subject: In the ASTImporter, when checking whether two X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fff418b1abea921685a1175a8ee0b597594bddc1;p=clang 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180644 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ASTImporter.cpp b/lib/AST/ASTImporter.cpp index 8b5f21ddda..20b905c376 100644 --- a/lib/AST/ASTImporter.cpp +++ b/lib/AST/ASTImporter.cpp @@ -839,6 +839,12 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, RecordDecl *D2 = Field2->getType()->castAs()->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())) {