diff options
Diffstat (limited to 'lib/Frontend/PCHReader.cpp')
-rw-r--r-- | lib/Frontend/PCHReader.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp index 7229775070..98b274d175 100644 --- a/lib/Frontend/PCHReader.cpp +++ b/lib/Frontend/PCHReader.cpp @@ -1739,6 +1739,15 @@ PCHReader::ReadPCHBlock(PerFileData &F) { DynamicClasses.swap(Record); break; + case pch::PENDING_IMPLICIT_INSTANTIATIONS: + // Optimization for the first block. + if (PendingImplicitInstantiations.empty()) + PendingImplicitInstantiations.swap(Record); + else + PendingImplicitInstantiations.insert( + PendingImplicitInstantiations.end(), Record.begin(), Record.end()); + break; + case pch::SEMA_DECL_REFS: if (!SemaDeclRefs.empty()) { Error("duplicate SEMA_DECL_REFS record in PCH file"); @@ -3191,6 +3200,16 @@ void PCHReader::InitializeSema(Sema &S) { SemaObj->DynamicClasses.push_back( cast<CXXRecordDecl>(GetDecl(DynamicClasses[I]))); + // If there were any pending implicit instantiations, deserialize them + // and add them to Sema's queue of such instantiations. + assert(PendingImplicitInstantiations.size() % 2 == 0 && + "Expected pairs of entries"); + for (unsigned Idx = 0, N = PendingImplicitInstantiations.size(); Idx < N;) { + ValueDecl *D=cast<ValueDecl>(GetDecl(PendingImplicitInstantiations[Idx++])); + SourceLocation Loc = ReadSourceLocation(PendingImplicitInstantiations, Idx); + SemaObj->PendingImplicitInstantiations.push_back(std::make_pair(D, Loc)); + } + // Load the offsets of the declarations that Sema references. // They will be lazily deserialized when needed. if (!SemaDeclRefs.empty()) { |