Update to match clang r223913.

llvm-svn: 223914
This commit is contained in:
Richard Smith 2014-12-10 03:10:06 +00:00
parent 9acb99e342
commit 2cf124a9f3
1 changed files with 14 additions and 1 deletions

View File

@ -292,8 +292,21 @@ bool ModuleMapChecker::loadModuleMap() {
// which doesn't forward the BeginSourceFile call, we do it explicitly here.
DC.BeginSourceFile(*LangOpts, nullptr);
// Figure out the home directory for the module map file.
// FIXME: Add an option to specify this.
const DirectoryEntry *Dir = ModuleMapEntry->getDir();
StringRef DirName(Dir->getName());
if (llvm::sys::path::filename(DirName) == "Modules") {
DirName = llvm::sys::path::parent_path(DirName);
if (DirName.endswith(".framework"))
Dir = FileMgr->getDirectory(DirName);
// FIXME: This assert can fail if there's a race between the above check
// and the removal of the directory.
assert(Dir && "parent must exist");
}
// Parse module.map file into module map.
if (ModMap->parseModuleMapFile(ModuleMapEntry, false))
if (ModMap->parseModuleMapFile(ModuleMapEntry, false, Dir))
return false;
// Do matching end call.