[cfe-commits] r171516 - /cfe/trunk/lib/Lex/ModuleMap.cpp

Douglas Gregor dgregor at apple.com
Fri Jan 4 11:44:26 PST 2013


Author: dgregor
Date: Fri Jan  4 13:44:26 2013
New Revision: 171516

URL: http://llvm.org/viewvc/llvm-project?rev=171516&view=rev
Log:
realpath'ify the mapping from header includes to module imports.

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

Modified: cfe/trunk/lib/Lex/ModuleMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=171516&r1=171515&r2=171516&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)
+++ cfe/trunk/lib/Lex/ModuleMap.cpp Fri Jan  4 13:44:26 2013
@@ -158,7 +158,20 @@
   
   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.





More information about the cfe-commits mailing list