diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-07-28 19:26:52 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-07-28 19:26:52 +0000 |
commit | bbbc367337e1dda1b72853f83216540dbe92e63f (patch) | |
tree | b0d15336e1cada97852a5e3448aa1b4e084aa975 /clang/lib/Serialization/ASTReader.cpp | |
parent | 4daf6a30e7a8bdb075bb54fb29392bdd2987ab7e (diff) | |
download | bcm5719-llvm-bbbc367337e1dda1b72853f83216540dbe92e63f.tar.gz bcm5719-llvm-bbbc367337e1dda1b72853f83216540dbe92e63f.zip |
Promote the deserialized PendingInstantiations vector from being a
Module member to being an ASTReader member; we want it to be
centralized for lazy deserialization.
llvm-svn: 136373
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 288e50df744..eced16a6ca7 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -2334,8 +2334,19 @@ ASTReader::ReadASTBlock(Module &F) { break; case PENDING_IMPLICIT_INSTANTIATIONS: - for (unsigned I = 0, N = Record.size(); I != N; ++I) - F.PendingInstantiations.push_back(getGlobalDeclID(F, Record[I])); + if (PendingInstantiations.size() % 2 != 0) { + Error("Invalid PENDING_IMPLICIT_INSTANTIATIONS block"); + return Failure; + } + + // Later lists of pending instantiations overwrite earlier ones. + // FIXME: This is most certainly wrong for modules. + PendingInstantiations.clear(); + for (unsigned I = 0, N = Record.size(); I != N; /* in loop */) { + PendingInstantiations.push_back(getGlobalDeclID(F, Record[I++])); + PendingInstantiations.push_back( + ReadSourceLocation(F, Record, I).getRawEncoding()); + } break; case SEMA_DECL_REFS: @@ -4394,17 +4405,12 @@ void ASTReader::InitializeSema(Sema &S) { SemaObj->StdBadAlloc = SemaDeclRefs[1]; } - // The special data sets below always come from the most recent PCH, - // which is at the front of the chain. - Module &F = ModuleMgr.getPrimaryModule(); - // If there were any pending implicit instantiations, deserialize them // and add them to Sema's queue of such instantiations. - assert(F.PendingInstantiations.size() % 2 == 0 && - "Expected pairs of entries"); - for (unsigned Idx = 0, N = F.PendingInstantiations.size(); Idx < N;) { - ValueDecl *D=cast<ValueDecl>(GetDecl(F.PendingInstantiations[Idx++])); - SourceLocation Loc = ReadSourceLocation(F, F.PendingInstantiations,Idx); + for (unsigned Idx = 0, N = PendingInstantiations.size(); Idx < N;) { + ValueDecl *D = cast<ValueDecl>(GetDecl(PendingInstantiations[Idx++])); + SourceLocation Loc + = SourceLocation::getFromRawEncoding(PendingInstantiations[Idx++]); SemaObj->PendingInstantiations.push_back(std::make_pair(D, Loc)); } |