From aa60f9cee8fa29cac1848de75ad48cdc0520e993 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Fri, 4 Jan 2013 19:44:26 +0000 Subject: 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 --- lib/Lex/ModuleMap.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/Lex/ModuleMap.cpp') 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. -- cgit v1.2.3