From: Douglas Gregor Date: Fri, 4 Jan 2013 19:44:26 +0000 (+0000) Subject: realpath'ify the mapping from header includes to module imports. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aa60f9cee8fa29cac1848de75ad48cdc0520e993;p=clang realpath'ify the mapping from header includes to module imports. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171516 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Lex/ModuleMap.cpp b/lib/Lex/ModuleMap.cpp index b815400754..d7bf45152d 100644 --- a/lib/Lex/ModuleMap.cpp +++ b/lib/Lex/ModuleMap.cpp @@ -158,7 +158,20 @@ Module *ModuleMap::findModuleForHeader(const FileEntry *File) { const DirectoryEntry *Dir = File->getDir(); llvm::SmallVector 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.