[cfe-commits] r45007 - /cfe/trunk/Basic/SourceManager.cpp

Ted Kremenek kremenek at apple.com
Thu Dec 13 10:12:10 PST 2007


Author: kremenek
Date: Thu Dec 13 12:12:10 2007
New Revision: 45007

URL: http://llvm.org/viewvc/llvm-project?rev=45007&view=rev
Log:
Add hack to SourceManager to support missing source files during
deserialization.  Eventually this should be replaced with a lazy-reading
mechanism that only reads source files when they are needed by clients.

Modified:
    cfe/trunk/Basic/SourceManager.cpp

Modified: cfe/trunk/Basic/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Basic/SourceManager.cpp?rev=45007&r1=45006&r2=45007&view=diff

==============================================================================
--- cfe/trunk/Basic/SourceManager.cpp (original)
+++ cfe/trunk/Basic/SourceManager.cpp Thu Dec 13 12:12:10 2007
@@ -441,10 +441,14 @@
     const char* start = &Buf[0];
     const FileEntry* E = FMgr->getFile(start,start+Buf.size());
     
-    assert (E && "Not yet supported: missing files.");
-    
-    // Get the ContextCache object and register it with the deserializer.
-    D.RegisterPtr(PtrID,SMgr.getContentCache(E));
+    // FIXME: Ideally we want a lazy materialization of the ContentCache
+    //  anyway, because we don't want to read in source files unless this
+    //  is absolutely needed.
+    if (!E)
+      D.RegisterPtr(PtrID,NULL);
+    else    
+      // Get the ContextCache object and register it with the deserializer.
+      D.RegisterPtr(PtrID,SMgr.getContentCache(E));
   }
   else {
     // Register the ContextCache object with the deserializer.





More information about the cfe-commits mailing list