summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTWriter.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-07-27 20:58:46 +0000
committerDouglas Gregor <dgregor@apple.com>2011-07-27 20:58:46 +0000
commiteb08bd48e6c5d26f445213a2756ded9b99197d57 (patch)
treef160c0b944d8061f702e5adafbbf8f9d3c43d462 /clang/lib/Serialization/ASTWriter.cpp
parent36ce7492a6b3a7261954edfe49126892b26b2acb (diff)
downloadbcm5719-llvm-eb08bd48e6c5d26f445213a2756ded9b99197d57.tar.gz
bcm5719-llvm-eb08bd48e6c5d26f445213a2756ded9b99197d57.zip
Introduce a new data structure, LazyVector, which is a vector whose
contents are lazily loaded on demand from an external source (e.g., an ExternalASTSource or ExternalSemaSource). The "loaded" entities are kept separate from the "local" entities, so that the two can grow independently. Switch Sema::TentativeDefinitions from a normal vector that is eagerly populated by the ASTReader into one of these LazyVectors, making the ASTReader a bit more like me (i.e., lazy). llvm-svn: 136262
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp19
1 files changed, 12 insertions, 7 deletions
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) {
OpenPOWER on IntegriCloud