From 2cf124a9f39928aada1966f2312cdc6da44cf733 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Wed, 10 Dec 2014 03:10:06 +0000 Subject: [PATCH] Update to match clang r223913. llvm-svn: 223914 --- clang-tools-extra/module-map-checker/ModuleMapChecker.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/clang-tools-extra/module-map-checker/ModuleMapChecker.cpp b/clang-tools-extra/module-map-checker/ModuleMapChecker.cpp index aaaddff..7a891ab 100644 --- a/clang-tools-extra/module-map-checker/ModuleMapChecker.cpp +++ b/clang-tools-extra/module-map-checker/ModuleMapChecker.cpp @@ -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. -- 2.7.4