diff options
Diffstat (limited to 'clang/lib/Serialization')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 17 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 19 |
2 files changed, 22 insertions, 14 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index b377be6267e..9f8514f1874 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -4328,13 +4328,6 @@ void ASTReader::InitializeSema(Sema &S) { } PreloadedDecls.clear(); - // If there were any tentative definitions, deserialize them and add - // them to Sema's list of tentative definitions. - for (unsigned I = 0, N = TentativeDefinitions.size(); I != N; ++I) { - VarDecl *Var = cast<VarDecl>(GetDecl(TentativeDefinitions[I])); - SemaObj->TentativeDefinitions.push_back(Var); - } - // If there were any unused file scoped decls, deserialize them and add to // Sema's list of unused file scoped decls. for (unsigned I = 0, N = UnusedFileScopedDecls.size(); I != N; ++I) { @@ -4571,6 +4564,16 @@ void ASTReader::ReadKnownNamespaces( } } +void ASTReader::ReadTentativeDefinitions( + SmallVectorImpl<VarDecl *> &TentativeDefs) { + for (unsigned I = 0, N = TentativeDefinitions.size(); I != N; ++I) { + VarDecl *Var = dyn_cast_or_null<VarDecl>(GetDecl(TentativeDefinitions[I])); + if (Var) + TentativeDefs.push_back(Var); + } + TentativeDefinitions.clear(); +} + void ASTReader::LoadSelector(Selector Sel) { // It would be complicated to avoid reading the methods anyway. So don't. ReadMethodPool(Sel); diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 14824a0810f..1acc140acdd 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -2805,10 +2805,13 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, MemorizeStatCalls *StatCalls, // TentativeDefinitions order. Generally, this record will be empty for // headers. RecordData TentativeDefinitions; - for (unsigned i = 0, e = SemaRef.TentativeDefinitions.size(); i != e; ++i) { - AddDeclRef(SemaRef.TentativeDefinitions[i], TentativeDefinitions); + for (Sema::TentativeDefinitionsType::iterator + T = SemaRef.TentativeDefinitions.begin(0, true), + TEnd = SemaRef.TentativeDefinitions.end(); + T != TEnd; ++T) { + AddDeclRef(*T, TentativeDefinitions); } - + // Build a record containing all of the file scoped decls in this file. RecordData UnusedFileScopedDecls; for (unsigned i=0, e = SemaRef.UnusedFileScopedDecls.size(); i !=e; ++i) @@ -3072,11 +3075,13 @@ void ASTWriter::WriteASTChain(Sema &SemaRef, MemorizeStatCalls *StatCalls, // Build a record containing all of the new tentative definitions in this // file, in TentativeDefinitions order. RecordData TentativeDefinitions; - for (unsigned i = 0, e = SemaRef.TentativeDefinitions.size(); i != e; ++i) { - if (SemaRef.TentativeDefinitions[i]->getPCHLevel() == 0) - AddDeclRef(SemaRef.TentativeDefinitions[i], TentativeDefinitions); + for (Sema::TentativeDefinitionsType::iterator + T = SemaRef.TentativeDefinitions.begin(0, true), + TEnd = SemaRef.TentativeDefinitions.end(); + T != TEnd; ++T) { + AddDeclRef(*T, TentativeDefinitions); } - + // Build a record containing all of the file scoped decls in this file. RecordData UnusedFileScopedDecls; for (unsigned i=0, e = SemaRef.UnusedFileScopedDecls.size(); i !=e; ++i) { |