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.

llvm-svn: 45007
This commit is contained in:
Ted Kremenek 2007-12-13 18:12:10 +00:00
parent 31dcdb312b
commit 2f4ab7148c
1 changed files with 8 additions and 4 deletions

View 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.