diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-05-19 20:59:20 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-05-19 20:59:20 +0000 |
commit | 851072efb735dcd66d1fbfaa434c2c9d7708e29a (patch) | |
tree | cfc7e71519d6586be724be73cee0593f7790fb6a /clang/lib/Serialization/ASTReader.cpp | |
parent | cb172b104a6ae03001dfc5a2971efc49cef083ab (diff) | |
download | bcm5719-llvm-851072efb735dcd66d1fbfaa434c2c9d7708e29a.tar.gz bcm5719-llvm-851072efb735dcd66d1fbfaa434c2c9d7708e29a.zip |
If two sibling modules declare the same entity, and we indirectly pull a
declaration of that entity in from one of those modules, keep track of the fact
that we've not completed the redeclaration chain yet so that we can pull the
remaining declarations in from the other module if they're needed.
llvm-svn: 209161
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index eb151ef16f6..f6d705af88c 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -5940,6 +5940,15 @@ Decl *ASTReader::GetExternalDecl(uint32_t ID) { } void ASTReader::CompleteRedeclChain(const Decl *D) { + if (NumCurrentElementsDeserializing) { + // We arrange to not care about the complete redeclaration chain while we're + // deserializing. Just remember that the AST has marked this one as complete + // but that it's not actually complete yet, so we know we still need to + // complete it later. + PendingIncompleteDeclChains.push_back(const_cast<Decl*>(D)); + return; + } + const DeclContext *DC = D->getDeclContext()->getRedeclContext(); // Recursively ensure that the decl context itself is complete @@ -7983,7 +7992,8 @@ std::string ASTReader::getOwningModuleNameForDiagnostic(const Decl *D) { } void ASTReader::finishPendingActions() { - while (!PendingIdentifierInfos.empty() || !PendingDeclChains.empty() || + while (!PendingIdentifierInfos.empty() || + !PendingIncompleteDeclChains.empty() || !PendingDeclChains.empty() || !PendingMacroIDs.empty() || !PendingDeclContextInfos.empty() || !PendingUpdateRecords.empty() || !PendingOdrMergeChecks.empty()) { // If any identifiers with corresponding top-level declarations have @@ -8001,6 +8011,13 @@ void ASTReader::finishPendingActions() { SetGloballyVisibleDecls(II, DeclIDs, &TopLevelDecls[II]); } + // For each decl chain that we wanted to complete while deserializing, mark + // it as "still needs to be completed". + for (unsigned I = 0; I != PendingIncompleteDeclChains.size(); ++I) { + markIncompleteDeclChain(PendingIncompleteDeclChains[I]); + } + PendingIncompleteDeclChains.clear(); + // Load pending declaration chains. for (unsigned I = 0; I != PendingDeclChains.size(); ++I) { loadPendingDeclChain(PendingDeclChains[I]); |