summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-07-26 23:54:23 +0000
committerDouglas Gregor <dgregor@apple.com>2010-07-26 23:54:23 +0000
commit81c000fb6d959b1d48d5a2a8657034c8df92eff3 (patch)
tree5ea1bc3f1e91287a7178493e58594e2040a4c282 /clang/lib/Basic
parentc698417e52f4d4dcc3cff0c654426bc49355644d (diff)
downloadbcm5719-llvm-81c000fb6d959b1d48d5a2a8657034c8df92eff3.tar.gz
bcm5719-llvm-81c000fb6d959b1d48d5a2a8657034c8df92eff3.zip
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... llvm-svn: 109470
Diffstat (limited to 'clang/lib/Basic')
-rw-r--r--clang/lib/Basic/FileManager.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp
index 3c91a0f875c..aa175cb1a6c 100644
--- a/clang/lib/Basic/FileManager.cpp
+++ b/clang/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;
}
OpenPOWER on IntegriCloud