r180644 - In the ASTImporter, when checking whether two

Sean Callanan scallanan at apple.com
Fri Apr 26 15:49:26 PDT 2013


Author: spyffe
Date: Fri Apr 26 17:49:25 2013
New Revision: 180644

URL: http://llvm.org/viewvc/llvm-project?rev=180644&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/AST/ASTImporter.cpp

Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=180644&r1=180643&r2=180644&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Fri Apr 26 17:49:25 2013
@@ -839,6 +839,12 @@ static bool IsStructurallyEquivalent(Str
     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())) {





More information about the cfe-commits mailing list