mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-11 02:16:50 +00:00
[HeaderSearch] loadSubdirectoryModuleMaps should respect -working-directory
Include search paths can be relative paths. The loadSubdirectoryModuleMaps function should account for that and respect the -working-directory parameter given to Clang. rdar://46045849 Differential Revision: https://reviews.llvm.org/D54503 llvm-svn: 346822
This commit is contained in:
parent
6bdabcf368
commit
7d76ef9b3d
@ -1638,8 +1638,10 @@ void HeaderSearch::loadSubdirectoryModuleMaps(DirectoryLookup &SearchDir) {
|
||||
return;
|
||||
|
||||
std::error_code EC;
|
||||
SmallString<128> Dir = SearchDir.getDir()->getName();
|
||||
FileMgr.makeAbsolutePath(Dir);
|
||||
SmallString<128> DirNative;
|
||||
llvm::sys::path::native(SearchDir.getDir()->getName(), DirNative);
|
||||
llvm::sys::path::native(Dir, DirNative);
|
||||
llvm::vfs::FileSystem &FS = *FileMgr.getVirtualFileSystem();
|
||||
for (llvm::vfs::directory_iterator Dir = FS.dir_begin(DirNative, EC), DirEnd;
|
||||
Dir != DirEnd && !EC; Dir.increment(EC)) {
|
||||
|
@ -0,0 +1 @@
|
||||
int bar();
|
@ -0,0 +1,5 @@
|
||||
module ModuleInSubdir {
|
||||
header "h1.h"
|
||||
export *
|
||||
}
|
||||
|
13
clang/test/Modules/subdirectory-module-maps-working-dir.m
Normal file
13
clang/test/Modules/subdirectory-module-maps-working-dir.m
Normal file
@ -0,0 +1,13 @@
|
||||
// RUN: rm -rf %t
|
||||
// RUN: %clang -fsyntax-only -fmodules -fmodules-cache-path=%t \
|
||||
// RUN: -working-directory %S/Inputs \
|
||||
// RUN: -I subdirectory-module-maps-working-dir \
|
||||
// RUN: %s -Werror=implicit-function-declaration -Xclang -verify
|
||||
|
||||
@import ModuleInSubdir;
|
||||
|
||||
void foo() {
|
||||
int x = bar();
|
||||
}
|
||||
|
||||
// expected-no-diagnostics
|
Loading…
x
Reference in New Issue
Block a user