If we're dealing with an overridden buffer in the AST reader, load the

file as a virtual file with the stored modification time and size.

llvm-svn: 144916
This commit is contained in:
Douglas Gregor 2011-11-17 19:08:51 +00:00
parent 14c62c8d02
commit be51458dc3
1 changed files with 4 additions and 2 deletions

View File

@ -1091,8 +1091,10 @@ ASTReader::ASTReadResult ASTReader::ReadSLocEntryRecord(int ID) {
std::string OrigFilename(BlobStart, BlobStart + BlobLen);
std::string Filename = OrigFilename;
MaybeAddSystemRootToFilename(Filename);
const FileEntry *File = FileMgr.getFile(Filename, /*OpenFile=*/false,
/*CacheFailure=*/!OverriddenBuffer);
const FileEntry *File =
OverriddenBuffer? FileMgr.getVirtualFile(Filename, (off_t)Record[4],
(time_t)Record[5])
: FileMgr.getFile(Filename, /*OpenFile=*/false);
if (File == 0 && !OriginalDir.empty() && !CurrentDir.empty() &&
OriginalDir != CurrentDir) {
std::string resolved = resolveFileRelativeToOriginalDir(Filename,