Index: cfe/trunk/lib/Lex/HeaderSearch.cpp =================================================================== --- cfe/trunk/lib/Lex/HeaderSearch.cpp +++ cfe/trunk/lib/Lex/HeaderSearch.cpp @@ -1638,8 +1638,10 @@ 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)) { Index: cfe/trunk/test/Modules/Inputs/subdirectory-module-maps-working-dir/subdir_module/h1.h =================================================================== --- cfe/trunk/test/Modules/Inputs/subdirectory-module-maps-working-dir/subdir_module/h1.h +++ cfe/trunk/test/Modules/Inputs/subdirectory-module-maps-working-dir/subdir_module/h1.h @@ -0,0 +1 @@ +int bar(); Index: cfe/trunk/test/Modules/Inputs/subdirectory-module-maps-working-dir/subdir_module/module.map =================================================================== --- cfe/trunk/test/Modules/Inputs/subdirectory-module-maps-working-dir/subdir_module/module.map +++ cfe/trunk/test/Modules/Inputs/subdirectory-module-maps-working-dir/subdir_module/module.map @@ -0,0 +1,5 @@ +module ModuleInSubdir { +header "h1.h" + export * +} + Index: cfe/trunk/test/Modules/subdirectory-module-maps-working-dir.m =================================================================== --- cfe/trunk/test/Modules/subdirectory-module-maps-working-dir.m +++ cfe/trunk/test/Modules/subdirectory-module-maps-working-dir.m @@ -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