summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2014-03-04 18:11:50 +0000
committerSean Callanan <scallanan@apple.com>2014-03-04 18:11:50 +0000
commitc94711c7e355c8d4ddaa08154e3149718e546c6b (patch)
tree6f75231a60fc545ea25ca619b247a448cdb42851 /clang/lib/AST
parent6931d6774abcafe5460a61a8d03f3822c656c4b4 (diff)
downloadbcm5719-llvm-c94711c7e355c8d4ddaa08154e3149718e546c6b.tar.gz
bcm5719-llvm-c94711c7e355c8d4ddaa08154e3149718e546c6b.zip
When deciding whether or not to resolve two
anonymous structs to the same Decl in the ASTImporter, ensure that both are filled in from their external sources (if present). Otherwise two different structs may be identified erroneously. llvm-svn: 202869
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/ASTImporter.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp
index e4a06ee7f8e..cb5939cd3d4 100644
--- a/clang/lib/AST/ASTImporter.cpp
+++ b/clang/lib/AST/ASTImporter.cpp
@@ -2538,6 +2538,21 @@ Decl *ASTNodeImporter::VisitRecordDecl(RecordDecl *D) {
} else if (!D->isCompleteDefinition()) {
// We have a forward declaration of this type, so adopt that forward
// declaration rather than building a new one.
+
+ // If one or both can be completed from external storage then try one
+ // last time to complete and compare them before doing this.
+
+ if (FoundRecord->hasExternalLexicalStorage() &&
+ !FoundRecord->isCompleteDefinition())
+ FoundRecord->getASTContext().getExternalSource()->CompleteType(FoundRecord);
+ if (D->hasExternalLexicalStorage())
+ D->getASTContext().getExternalSource()->CompleteType(D);
+
+ if (FoundRecord->isCompleteDefinition() &&
+ D->isCompleteDefinition() &&
+ !IsStructuralMatch(D, FoundRecord))
+ continue;
+
AdoptDecl = FoundRecord;
continue;
} else if (!SearchName) {
OpenPOWER on IntegriCloud