diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-07-26 23:54:23 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-07-26 23:54:23 +0000 |
commit | 3e15e0a7b4da6d906357b00b1bd2bba5ec3195ed (patch) | |
tree | 696f5bd7b8705631692abb79d5aa73c2fdbbfdd1 /lib/Basic/FileManager.cpp | |
parent | e42b8a596886fc98e367c73e54d761446700029e (diff) |
When remapping a virtual file, also make an entry for the file with
its absolute path on disk. Also, introduce a fun test for the
precompiled preamble, which almost works...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109470 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/FileManager.cpp')
-rw-r--r-- | lib/Basic/FileManager.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Basic/FileManager.cpp b/lib/Basic/FileManager.cpp index 3c91a0f875..aa175cb1a6 100644 --- a/lib/Basic/FileManager.cpp +++ b/lib/Basic/FileManager.cpp @@ -365,6 +365,18 @@ FileManager::getVirtualFile(llvm::StringRef Filename, off_t Size, UFE->ModTime = ModificationTime; UFE->Dir = DirInfo; UFE->UID = NextFileUID++; + + // If this virtual file resolves to a file, also map that file to the + // newly-created file entry. + const char *InterndFileName = NamedFileEnt.getKeyData(); + struct stat StatBuf; + if (!stat_cached(InterndFileName, &StatBuf) && + !S_ISDIR(StatBuf.st_mode)) { + llvm::sys::Path FilePath(InterndFileName); + FilePath.makeAbsolute(); + FileEntries[FilePath.str()] = UFE; + } + return UFE; } |