[llvm-branch-commits] [cfe-branch] r73493 - in /cfe/branches/Apple/Dib/lib/Frontend: PCHReader.cpp PCHWriter.cpp PCHWriterDecl.cpp

Daniel Dunbar daniel at zuster.org
Tue Jun 16 09:21:55 PDT 2009


Author: ddunbar
Date: Tue Jun 16 11:21:55 2009
New Revision: 73493

URL: http://llvm.org/viewvc/llvm-project?rev=73493&view=rev
Log:
Merge in 72252, 72681, 72759, 73371 (<rdar://problem/6974792>):

------------------------------------------------------------------------
r72252 | zhongxingxu | 2009-05-22 01:38:27 -0700 (Fri, 22 May 2009) | 2 lines

Pull EmitRecord() out of loop. It should be called only once.

------------------------------------------------------------------------

------------------------------------------------------------------------
r72681 | zhongxingxu | 2009-05-31 17:49:11 -0700 (Sun, 31 May 2009) | 2 lines

Use a reference to modify the DeclIDs map.

------------------------------------------------------------------------

------------------------------------------------------------------------
r72759 | zhongxingxu | 2009-06-03 02:23:28 -0700 (Wed, 03 Jun 2009) | 2 lines

emit ORIGINAL_FILE_NAME record ID to blockinfo block.

------------------------------------------------------------------------

------------------------------------------------------------------------
r73371 | lattner | 2009-06-14 21:35:16 -0700 (Sun, 14 Jun 2009) | 6 lines

If PCH refers to a file that doesn't exist anymore, emit a nice error
like:
fatal error: could not find file '1.h' referenced by PCH file
instead of aborting with an assertion failure, PR4219


------------------------------------------------------------------------

Modified:
    cfe/branches/Apple/Dib/lib/Frontend/PCHReader.cpp
    cfe/branches/Apple/Dib/lib/Frontend/PCHWriter.cpp
    cfe/branches/Apple/Dib/lib/Frontend/PCHWriterDecl.cpp

Modified: cfe/branches/Apple/Dib/lib/Frontend/PCHReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Frontend/PCHReader.cpp?rev=73493&r1=73492&r2=73493&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/Frontend/PCHReader.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Frontend/PCHReader.cpp Tue Jun 16 11:21:55 2009
@@ -804,9 +804,16 @@
     return Failure;
 
   case pch::SM_SLOC_FILE_ENTRY: {
-    const FileEntry *File 
-      = PP.getFileManager().getFile(BlobStart, BlobStart + BlobLen);
-    // FIXME: Error recovery if file cannot be found.
+    const FileEntry *File = PP.getFileManager().getFile(BlobStart,
+                                                        BlobStart + BlobLen);
+    if (File == 0) {
+      std::string ErrorStr = "could not find file '";
+      ErrorStr.append(BlobStart, BlobLen);
+      ErrorStr += "' referenced by PCH file";
+      Error(ErrorStr.c_str());
+      return Failure;
+    }
+    
     FileID FID = SourceMgr.createFileID(File,
                                 SourceLocation::getFromRawEncoding(Record[1]),
                                        (SrcMgr::CharacteristicKind)Record[2],

Modified: cfe/branches/Apple/Dib/lib/Frontend/PCHWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Frontend/PCHWriter.cpp?rev=73493&r1=73492&r2=73493&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/Frontend/PCHWriter.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Frontend/PCHWriter.cpp Tue Jun 16 11:21:55 2009
@@ -345,6 +345,7 @@
  
   // PCH Top-Level Block.
   BLOCK(PCH_BLOCK);
+  RECORD(ORIGINAL_FILE_NAME);
   RECORD(TYPE_OFFSET);
   RECORD(DECL_OFFSET);
   RECORD(LANGUAGE_OPTIONS);
@@ -761,8 +762,8 @@
         Record.push_back((unsigned)LE->FileKind);
         Record.push_back(LE->IncludeOffset);
       }
-      Stream.EmitRecord(pch::SM_LINE_TABLE, Record);
     }
+    Stream.EmitRecord(pch::SM_LINE_TABLE, Record);
   }
 
   // Write out entries for all of the header files we know about.

Modified: cfe/branches/Apple/Dib/lib/Frontend/PCHWriterDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Frontend/PCHWriterDecl.cpp?rev=73493&r1=73492&r2=73493&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/Frontend/PCHWriterDecl.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Frontend/PCHWriterDecl.cpp Tue Jun 16 11:21:55 2009
@@ -483,7 +483,7 @@
     }
 
     // Determine the ID for this declaration
-    pch::DeclID ID = DeclIDs[D];
+    pch::DeclID& ID = DeclIDs[D];
     if (ID == 0)
       ID = DeclIDs.size();
 





More information about the llvm-branch-commits mailing list