aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/PCHReader.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-13 17:12:42 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-13 17:12:42 +0000
commitff0a9872aafbe9c0c37b06f33ed013471fc361f8 (patch)
treebbef7605799d97dfa6e0ff13863638de1389deb8 /lib/Frontend/PCHReader.cpp
parentbd94500d3aa60092fb0f1e90f53fb0d03fa502a8 (diff)
Make the reading of the line table from a PCH file more robust against
the unlikely event that the filename IDs in the stored line table end up being different from the filename IDs in the newly-created line table. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68965 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PCHReader.cpp')
-rw-r--r--lib/Frontend/PCHReader.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp
index 4998de371f..9a0061ea0e 100644
--- a/lib/Frontend/PCHReader.cpp
+++ b/lib/Frontend/PCHReader.cpp
@@ -200,21 +200,20 @@ static bool ParseLineTable(SourceManager &SourceMgr,
LineTableInfo &LineTable = SourceMgr.getLineTable();
// Parse the file names
- for (unsigned I = 0, N = Record[Idx++]; I != N; ++I) {
+ std::map<int, int> FileIDs;
+ for (int I = 0, N = Record[Idx++]; I != N; ++I) {
// Extract the file name
unsigned FilenameLen = Record[Idx++];
std::string Filename(&Record[Idx], &Record[Idx] + FilenameLen);
Idx += FilenameLen;
- unsigned ID = LineTable.getLineTableFilenameID(Filename.c_str(),
- Filename.size());
- if (ID != I)
- return Error("Filename ID mismatch in PCH line table");
+ FileIDs[I] = LineTable.getLineTableFilenameID(Filename.c_str(),
+ Filename.size());
}
// Parse the line entries
std::vector<LineEntry> Entries;
while (Idx < Record.size()) {
- unsigned FID = Record[Idx++];
+ int FID = FileIDs[Record[Idx++]];
// Extract the line entries
unsigned NumEntries = Record[Idx++];