<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Mar 4, 2014 at 10:11 AM, Sean Callanan <span dir="ltr"><<a href="mailto:scallanan@apple.com" target="_blank">scallanan@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: spyffe<br>
Date: Tue Mar  4 12:11:50 2014<br>
New Revision: 202869<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=202869&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=202869&view=rev</a><br>
Log:<br>
When deciding whether or not to resolve two<br>
anonymous structs to the same Decl in the<br>
ASTImporter, ensure that both are filled in<br>
from their external sources (if present).<br>
Otherwise two different structs may be<br>
identified erroneously.<br></blockquote><div><br></div><div>Test case?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Modified:<br>
    cfe/trunk/lib/AST/ASTImporter.cpp<br>
<br>
Modified: cfe/trunk/lib/AST/ASTImporter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=202869&r1=202868&r2=202869&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=202869&r1=202868&r2=202869&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)<br>
+++ cfe/trunk/lib/AST/ASTImporter.cpp Tue Mar  4 12:11:50 2014<br>
@@ -2538,6 +2538,21 @@ Decl *ASTNodeImporter::VisitRecordDecl(R<br>
         } else if (!D->isCompleteDefinition()) {<br>
           // We have a forward declaration of this type, so adopt that forward<br>
           // declaration rather than building a new one.<br>
+<br>
+          // If one or both can be completed from external storage then try one<br>
+          // last time to complete and compare them before doing this.<br>
+<br>
+          if (FoundRecord->hasExternalLexicalStorage() &&<br>
+              !FoundRecord->isCompleteDefinition())<br>
+            FoundRecord->getASTContext().getExternalSource()->CompleteType(FoundRecord);<br>
+          if (D->hasExternalLexicalStorage())<br>
+            D->getASTContext().getExternalSource()->CompleteType(D);<br>
+<br>
+          if (FoundRecord->isCompleteDefinition() &&<br>
+              D->isCompleteDefinition() &&<br>
+              !IsStructuralMatch(D, FoundRecord))<br>
+            continue;<br>
+<br>
           AdoptDecl = FoundRecord;<br>
           continue;<br>
         } else if (!SearchName) {<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div></div>