diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-08-25 21:09:44 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-08-25 21:09:44 +0000 |
commit | f249bf3b9f8bd3af711ffe9de411fc435871a4f6 (patch) | |
tree | fb4e412d8e7580eb5e0dc5a70c31c5d55fbd5fa4 /lib | |
parent | f09530f88ece49993f1b72271b0417574e897956 (diff) |
Preload source location entries as soon as we've loaded a particular
AST file, rather than waiting until we finish loading the top-level
AST file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138585 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Serialization/ASTReader.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index c9a8380ff6..86625b7bdf 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -2216,9 +2216,12 @@ ASTReader::ReadASTBlock(Module &F) { case SOURCE_LOCATION_PRELOADS: { // Need to transform from the local view (1-based IDs) to the global view, // which is based off F.SLocEntryBaseID. - PreloadSLocEntries.reserve(PreloadSLocEntries.size() + Record.size()); - for (unsigned I = 0, N = Record.size(); I != N; ++I) - PreloadSLocEntries.push_back(int(Record[I] - 1) + F.SLocEntryBaseID); + if (!F.PreloadSLocEntries.empty()) { + Error("Multiple SOURCE_LOCATION_PRELOADS records in AST file"); + return Failure; + } + + F.PreloadSLocEntries.swap(Record); break; } @@ -2546,14 +2549,6 @@ ASTReader::ASTReadResult ASTReader::ReadAST(const std::string &FileName, } // Here comes stuff that we only do once the entire chain is loaded. - - // Preload SLocEntries. - for (unsigned I = 0, N = PreloadSLocEntries.size(); I != N; ++I) { - ASTReadResult Result = ReadSLocEntryRecord(PreloadSLocEntries[I]); - if (Result != Success) - return Failure; - } - PreloadSLocEntries.clear(); // Check the predefines buffers. if (!DisableValidation && Type != MK_Module && CheckPredefinesBuffers()) @@ -2742,6 +2737,15 @@ ASTReader::ASTReadResult ASTReader::ReadASTCore(StringRef FileName, case Success: break; } } + + // Preload SLocEntries. + for (unsigned I = 0, N = M->PreloadSLocEntries.size(); I != N; ++I) { + int Index = int(M->PreloadSLocEntries[I] - 1) + F.SLocEntryBaseID; + ASTReadResult Result = ReadSLocEntryRecord(Index); + if (Result != Success) + return Failure; + } + return Success; } |