[cfe-commits] r164620 - /cfe/trunk/lib/Lex/HeaderSearch.cpp

Douglas Gregor dgregor at apple.com
Tue Sep 25 11:29:14 PDT 2012


Author: dgregor
Date: Tue Sep 25 13:29:14 2012
New Revision: 164620

URL: http://llvm.org/viewvc/llvm-project?rev=164620&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/Lex/HeaderSearch.cpp

Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=164620&r1=164619&r2=164620&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/HeaderSearch.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderSearch.cpp Tue Sep 25 13:29:14 2012
@@ -905,7 +905,20 @@
   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);





More information about the cfe-commits mailing list