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
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp
index 4998de3..9a0061e 100644
--- a/lib/Frontend/PCHReader.cpp
+++ b/lib/Frontend/PCHReader.cpp
@@ -200,21 +200,20 @@
   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++];