summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-09-19 20:39:54 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-09-19 20:39:54 +0000
commitb527a7cbf8cf24bc3472db86e5d90d931544ce00 (patch)
tree72cf3fa26e8e1ec734b754795799670ef8203f95
parent8b7c08b8975288df9cdeb17973d5570baaf583cc (diff)
downloadbcm5719-llvm-b527a7cbf8cf24bc3472db86e5d90d931544ce00.tar.gz
bcm5719-llvm-b527a7cbf8cf24bc3472db86e5d90d931544ce00.zip
[PCH] Preload the PreloadSLocEntries through the SourceManager and
don't call ReadSLocEntryRecord() directly because the entry may have already been loaded in which case calling ReadSLocEntryRecord() directly would trigger an assertion in SourceManager. llvm-svn: 140052
-rw-r--r--clang/include/clang/Basic/SourceManager.h3
-rw-r--r--clang/lib/Serialization/ASTReader.cpp8
2 files changed, 8 insertions, 3 deletions
diff --git a/clang/include/clang/Basic/SourceManager.h b/clang/include/clang/Basic/SourceManager.h
index fb48430e25c..9dc19458521 100644
--- a/clang/include/clang/Basic/SourceManager.h
+++ b/clang/include/clang/Basic/SourceManager.h
@@ -1296,6 +1296,9 @@ private:
getDecomposedSpellingLocSlowCase(const SrcMgr::SLocEntry *E,
unsigned Offset) const;
void computeMacroArgsCache(SrcMgr::ContentCache *Content, FileID FID);
+
+ friend class ASTReader;
+ friend class ASTWriter;
};
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index e4f9fa693c8..6c0afb59b40 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -2633,9 +2633,11 @@ ASTReader::ASTReadResult ASTReader::ReadASTCore(StringRef FileName,
// 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;
+ // Load it through the SourceManager and don't call ReadSLocEntryRecord()
+ // directly because the entry may have already been loaded in which case
+ // calling ReadSLocEntryRecord() directly would trigger an assertion in
+ // SourceManager.
+ SourceMgr.getLoadedSLocEntryByID(Index);
}
OpenPOWER on IntegriCloud