aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2013-04-26 22:49:25 +0000
committerSean Callanan <scallanan@apple.com>2013-04-26 22:49:25 +0000
commitfff418b1abea921685a1175a8ee0b597594bddc1 (patch)
treebeebd58d2fa8449c52bdf36df128b224f168498c
parente858e667c14ce4a9df5a4bbae770a0a3a3c8723e (diff)
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
-rw-r--r--lib/AST/ASTImporter.cpp6
1 files changed, 6 insertions, 0 deletions
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<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())) {