diff options
Diffstat (limited to 'clang/lib/Serialization')
| -rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 9 | ||||
| -rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 13 |
2 files changed, 22 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 910f5dcf779..aa672b3a7ec 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -3606,6 +3606,9 @@ ASTReader::ASTReadResult ASTReader::ReadAST(StringRef FileName, Id != IdEnd; ++Id) Id->second->setOutOfDate(true); } + // Mark selectors as out of date. + for (auto Sel : SelectorGeneration) + SelectorOutOfDate[Sel.first] = true; // Resolve any unresolved module exports. for (unsigned I = 0, N = UnresolvedModuleRefs.size(); I != N; ++I) { @@ -7139,6 +7142,7 @@ void ASTReader::ReadMethodPool(Selector Sel) { unsigned &Generation = SelectorGeneration[Sel]; unsigned PriorGeneration = Generation; Generation = getGeneration(); + SelectorOutOfDate[Sel] = false; // Search for methods defined with this selector. ++NumMethodPoolLookups; @@ -7170,6 +7174,11 @@ void ASTReader::ReadMethodPool(Selector Sel) { addMethodsToPool(S, Visitor.getFactoryMethods(), Pos->second.second); } +void ASTReader::updateOutOfDateSelector(Selector Sel) { + if (SelectorOutOfDate[Sel]) + ReadMethodPool(Sel); +} + void ASTReader::ReadKnownNamespaces( SmallVectorImpl<NamespaceDecl *> &Namespaces) { Namespaces.clear(); diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 32c9c4787c4..606228af753 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -4387,6 +4387,19 @@ uint64_t ASTWriter::WriteASTCore(Sema &SemaRef, StringRef isysroot, } } + // For method pool in the module, if it contains an entry for a selector, + // the entry should be complete, containing everything introduced by that + // module and all modules it imports. It's possible that the entry is out of + // date, so we need to pull in the new content here. + + // It's possible that updateOutOfDateSelector can update SelectorIDs. To be + // safe, we copy all selectors out. + llvm::SmallVector<Selector, 256> AllSelectors; + for (auto &SelectorAndID : SelectorIDs) + AllSelectors.push_back(SelectorAndID.first); + for (auto &Selector : AllSelectors) + SemaRef.updateOutOfDateSelector(Selector); + // Form the record of special types. RecordData SpecialTypes; AddTypeRef(Context.getRawCFConstantStringType(), SpecialTypes); |

