summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-09-25 18:29:14 +0000
committerDouglas Gregor <dgregor@apple.com>2012-09-25 18:29:14 +0000
commit24ff3bc3922dd1e6236dd50ba745c9647f4b9e3e (patch)
tree7a668a34032d08f8159759b8b55647436ea34efa /clang/lib
parent984fee5b8f45060e7fc70cbd956c01bb97015afb (diff)
downloadbcm5719-llvm-24ff3bc3922dd1e6236dd50ba745c9647f4b9e3e.tar.gz
bcm5719-llvm-24ff3bc3922dd1e6236dd50ba745c9647f4b9e3e.zip
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. llvm-svn: 164620
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Lex/HeaderSearch.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp
index e793ea17e86..33bba9bd041 100644
--- a/clang/lib/Lex/HeaderSearch.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud