summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/HeaderSearch.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2013-01-26 00:55:12 +0000
committerDouglas Gregor <dgregor@apple.com>2013-01-26 00:55:12 +0000
commite00c8b205e24122ce3cb6169dd4e85c16c2fdadd (patch)
treeb7b20eca5a8cd95c9c0385a8a05cfcdcc605efce /clang/lib/Lex/HeaderSearch.cpp
parentd0c842d7a496b15d2b771c9ee605c1570ba49793 (diff)
downloadbcm5719-llvm-e00c8b205e24122ce3cb6169dd4e85c16c2fdadd.tar.gz
bcm5719-llvm-e00c8b205e24122ce3cb6169dd4e85c16c2fdadd.zip
Since we're stuck with realpath for the header <-> module mapping,
factor the realpath calls into FileManager::getCanonicalName() so we can cache the results of this epically slow operation. 5% speedup on my modules test, and realpath drops out of the profile. llvm-svn: 173542
Diffstat (limited to 'clang/lib/Lex/HeaderSearch.cpp')
-rw-r--r--clang/lib/Lex/HeaderSearch.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp
index 14d44cc3da2..64329255184 100644
--- a/clang/lib/Lex/HeaderSearch.cpp
+++ b/clang/lib/Lex/HeaderSearch.cpp
@@ -268,6 +268,10 @@ const FileEntry *DirectoryLookup::LookupFile(
return Result;
}
+/// FIXME: HACK HACK HACK!
+static llvm::DenseMap<const DirectoryEntry *, const DirectoryEntry *>
+ TopFrameworkDirs;
+
/// \brief Given a framework directory, find the top-most framework directory.
///
/// \param FileMgr The file manager to use for directory lookups.
@@ -280,7 +284,6 @@ getTopFrameworkDir(FileManager &FileMgr, StringRef DirName,
assert(llvm::sys::path::extension(DirName) == ".framework" &&
"Not a framework directory");
-#ifdef LLVM_ON_UNIX
// Note: as an egregious but useful hack we use the real path here, because
// frameworks moving between top-level frameworks to embedded frameworks tend
// to be symlinked, and we base the logical structure of modules on the
@@ -295,12 +298,8 @@ getTopFrameworkDir(FileManager &FileMgr, StringRef DirName,
//
// Similar issues occur when a top-level framework has moved into an
// embedded framework.
- char RealDirName[PATH_MAX];
- if (realpath(DirName.str().c_str(), RealDirName))
- DirName = RealDirName;
-#endif
-
const DirectoryEntry *TopFrameworkDir = FileMgr.getDirectory(DirName);
+ DirName = FileMgr.getCanonicalName(TopFrameworkDir);
do {
// Get the parent directory name.
DirName = llvm::sys::path::parent_path(DirName);
OpenPOWER on IntegriCloud