diff options
author | Douglas Gregor <dgregor@apple.com> | 2013-01-04 19:44:26 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2013-01-04 19:44:26 +0000 |
commit | aa60f9cee8fa29cac1848de75ad48cdc0520e993 (patch) | |
tree | 6e6aefc4c7c88fa3503201d6b12f4ee8d1b6b9fe /lib/Lex/ModuleMap.cpp | |
parent | 34b3366820626278be37bbf8f41f54e4b66309ac (diff) |
realpath'ify the mapping from header includes to module imports.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171516 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/ModuleMap.cpp')
-rw-r--r-- | lib/Lex/ModuleMap.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Lex/ModuleMap.cpp b/lib/Lex/ModuleMap.cpp index b815400754..d7bf45152d 100644 --- a/lib/Lex/ModuleMap.cpp +++ b/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. |