summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/HeaderSearch.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-03-09 00:58:22 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-03-09 00:58:22 +0000
commit3f57cff1e821d742c71e46dae67aadd65e2f1be2 (patch)
tree7c761e2124bec55515bb28d994e8a9743dcdeaf3 /clang/lib/Lex/HeaderSearch.cpp
parentd923a35f3424e57504b44559ba893c4402bd4b24 (diff)
downloadbcm5719-llvm-3f57cff1e821d742c71e46dae67aadd65e2f1be2.tar.gz
bcm5719-llvm-3f57cff1e821d742c71e46dae67aadd65e2f1be2.zip
Fix handling of -fmodule-map-file=X where X has no directory component.
llvm-svn: 297349
Diffstat (limited to 'clang/lib/Lex/HeaderSearch.cpp')
-rw-r--r--clang/lib/Lex/HeaderSearch.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp
index c667f4bf220..4ee38719289 100644
--- a/clang/lib/Lex/HeaderSearch.cpp
+++ b/clang/lib/Lex/HeaderSearch.cpp
@@ -172,8 +172,10 @@ std::string HeaderSearch::getModuleFileName(StringRef ModuleName,
//
// To avoid false-negatives, we form as canonical a path as we can, and map
// to lower-case in case we're on a case-insensitive file system.
- auto *Dir =
- FileMgr.getDirectory(llvm::sys::path::parent_path(ModuleMapPath));
+ std::string Parent = llvm::sys::path::parent_path(ModuleMapPath);
+ if (Parent.empty())
+ Parent = ".";
+ auto *Dir = FileMgr.getDirectory(Parent);
if (!Dir)
return std::string();
auto DirName = FileMgr.getCanonicalName(Dir);
OpenPOWER on IntegriCloud