forked from OSchip/llvm-project
Fix handling of -fmodule-map-file=X where X has no directory component.
llvm-svn: 297349
This commit is contained in:
parent
d923a35f34
commit
3f57cff1e8
|
@ -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);
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: mkdir %t
|
||||
// RUN: echo 'module X { header "x.h" }' > %t/map
|
||||
// RUN: echo 'extern int n;' > %t/x.h
|
||||
// RUN: cd %t
|
||||
// RUN: %clang_cc1 %s -fmodules -fmodule-map-file=map -fmodules-cache-path=. -verify -I.
|
||||
// expected-no-diagnostics
|
||||
#include "x.h"
|
||||
int *m = &n;
|
Loading…
Reference in New Issue