]> granicus.if.org Git - clang/commitdiff
Add hack to SourceManager to support missing source files during
authorTed Kremenek <kremenek@apple.com>
Thu, 13 Dec 2007 18:12:10 +0000 (18:12 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 13 Dec 2007 18:12:10 +0000 (18:12 +0000)
deserialization.  Eventually this should be replaced with a lazy-reading
mechanism that only reads source files when they are needed by clients.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45007 91177308-0d34-0410-b5e6-96231b3b80d8

Basic/SourceManager.cpp

index bfa77923b079bd713a39db2cda4f1d6311f1f5fc..22a7cf511f23254ff600dd985fc344a038729853 100644 (file)
@@ -441,10 +441,14 @@ void ContentCache::ReadToSourceManager(llvm::Deserializer& D,
     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.