forked from OSchip/llvm-project
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
This commit is contained in:
parent
6931d6774a
commit
c94711c7e3
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue