]> granicus.if.org Git - clang/commitdiff
realpath'ify the mapping from header includes to module imports.
authorDouglas Gregor <dgregor@apple.com>
Fri, 4 Jan 2013 19:44:26 +0000 (19:44 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 4 Jan 2013 19:44:26 +0000 (19:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171516 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/ModuleMap.cpp

index b815400754da5ae36092290968bc45186a21224b..d7bf45152d9d9653a5db54efbe3f69f00320f42a 100644 (file)
@@ -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.