[cfe-dev] PCHReader: FileIDs in ParseLineTable()

Zhongxing Xu xuzhongxing at gmail.com
Fri May 22 02:00:41 PDT 2009


Hi,

The FileIDs in ParseLineTable() of PCHReader.cpp probably is not
needed, since we emit filenames in their ID order, and read filenames
in the same order. The file IDs remains unchanged. In practice we are
always creating identity mapping from x to x.

A patch:

Index: lib/Frontend/PCHReader.cpp
===================================================================
--- lib/Frontend/PCHReader.cpp	(版本 72237)
+++ lib/Frontend/PCHReader.cpp	(工作副本)
@@ -548,20 +548,18 @@
   LineTableInfo &LineTable = SourceMgr.getLineTable();

   // Parse the file names
-  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;
-    FileIDs[I] = LineTable.getLineTableFilenameID(Filename.c_str(),
-                                                  Filename.size());
+    LineTable.getLineTableFilenameID(Filename.c_str(), Filename.size());
   }

   // Parse the line entries
   std::vector<LineEntry> Entries;
   while (Idx < Record.size()) {
-    int FID = FileIDs[Record[Idx++]];
+    int FID = Record[Idx++];

     // Extract the line entries
     unsigned NumEntries = Record[Idx++];




More information about the cfe-dev mailing list