diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-04-13 17:12:42 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-04-13 17:12:42 +0000 |
commit | a8854654ac2d05fd5d04afdcfd9204e5b8603b3f (patch) | |
tree | c728f38a5d2ae459603e35777db00d58f5934fc9 /clang/lib | |
parent | 80be3511edf9ce81d93c0cf5167b666c637a53f3 (diff) | |
download | bcm5719-llvm-a8854654ac2d05fd5d04afdcfd9204e5b8603b3f.tar.gz bcm5719-llvm-a8854654ac2d05fd5d04afdcfd9204e5b8603b3f.zip |
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.
llvm-svn: 68965
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Frontend/PCHReader.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/clang/lib/Frontend/PCHReader.cpp b/clang/lib/Frontend/PCHReader.cpp index 4998de371fe..9a0061ea0ee 100644 --- a/clang/lib/Frontend/PCHReader.cpp +++ b/clang/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++]; |