diff options
| author | Sean Callanan <scallanan@apple.com> | 2013-04-26 22:49:25 +0000 |
|---|---|---|
| committer | Sean Callanan <scallanan@apple.com> | 2013-04-26 22:49:25 +0000 |
| commit | 969c5bd2d82c6c0a28f62e643219b7092663375c (patch) | |
| tree | ca131ac21504f04012167a50d78999af2bcef4a3 | |
| parent | 12fdb9e34b8cc4cc848d4ef8c601de5e5faf694d (diff) | |
| download | bcm5719-llvm-969c5bd2d82c6c0a28f62e643219b7092663375c.tar.gz bcm5719-llvm-969c5bd2d82c6c0a28f62e643219b7092663375c.zip | |
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
| -rw-r--r-- | clang/lib/AST/ASTImporter.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index 8b5f21ddda0..20b905c376b 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/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())) { |

