aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/ModuleMap.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2013-01-04 19:44:26 +0000
committerDouglas Gregor <dgregor@apple.com>2013-01-04 19:44:26 +0000
commit7426050269de509598f33620634826a5021b8628 (patch)
treed5950f707117d8ff77e2ce41bf50bad147e1c268 /clang/lib/Lex/ModuleMap.cpp
parente067e5a13fb3147df2b117dac8ce4807f63c51f6 (diff)
downloadllvm-7426050269de509598f33620634826a5021b8628.zip
llvm-7426050269de509598f33620634826a5021b8628.tar.gz
llvm-7426050269de509598f33620634826a5021b8628.tar.bz2
realpath'ify the mapping from header includes to module imports.
llvm-svn: 171516
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
-rw-r--r--clang/lib/Lex/ModuleMap.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index b815400..d7bf451 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/lib/Lex/ModuleMap.cpp
@@ -158,7 +158,20 @@ Module *ModuleMap::findModuleForHeader(const FileEntry *File) {
const DirectoryEntry *Dir = File->getDir();
llvm::SmallVector<const DirectoryEntry *, 2> SkippedDirs;
+#ifdef LLVM_ON_UNIX
+ // Note: as an egregious but useful hack we use the real path here, because
+ // frameworks moving from top-level frameworks to embedded frameworks tend
+ // to be symlinked from the top-level location to the embedded location,
+ // and we need to resolve lookups as if we had found the embedded location.
+ char RealDirName[PATH_MAX];
+ StringRef DirName;
+ if (realpath(Dir->getName(), RealDirName))
+ DirName = RealDirName;
+ else
+ DirName = Dir->getName();
+#else
StringRef DirName = Dir->getName();
+#endif
// Keep walking up the directory hierarchy, looking for a directory with
// an umbrella header.