diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-09-25 18:29:14 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-09-25 18:29:14 +0000 |
commit | 156f0f0c0d733f668a43526d62b8149c068cb3a0 (patch) | |
tree | 90cc3085f8b3b11e2679a70b0de2489521b1240e /lib/Lex/HeaderSearch.cpp | |
parent | 4d7e0ced7f16a04aabe2d8d91cbbb52fb1162810 (diff) |
Under certain terrible circumstances (<rdar://problem/10805775>),
top-level frameworks can actually be symlinked over to embedded
frameworks, and accessed via the top-level framework's headers. In
this case, we need to determine that the framework was *actually* an
embedded framework, so we can load the appropriate top-level module.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164620 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/HeaderSearch.cpp')
-rw-r--r-- | lib/Lex/HeaderSearch.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Lex/HeaderSearch.cpp b/lib/Lex/HeaderSearch.cpp index e793ea17e8..33bba9bd04 100644 --- a/lib/Lex/HeaderSearch.cpp +++ b/lib/Lex/HeaderSearch.cpp @@ -905,7 +905,20 @@ Module *HeaderSearch::loadFrameworkModule(StringRef Name, SubmodulePath.push_back(Name); // Walk the directory structure to find any enclosing frameworks. +#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 do { // Get the parent directory name. DirName = llvm::sys::path::parent_path(DirName); |