Skip to content

Commit 3056727

Browse files
authored
[clang][lex] Use FileManager to make prebuilt module paths absolute (#165347)
This PR switches from using `llvm::sys::fs::make_absolute()` to `FileManager::makeAbsolutePath()` so that `FileSystemOptions` (i.e. the `-working-directory` option) and the `VFS`'s CWD have a say in how the prebuilt module paths are resolved. This matches how the rest of the compiler treats input files.
1 parent 22079e3 commit 3056727

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/lib/Lex/HeaderSearch.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ std::string HeaderSearch::getPrebuiltModuleFileName(StringRef ModuleName,
221221
// file.
222222
for (const std::string &Dir : HSOpts.PrebuiltModulePaths) {
223223
SmallString<256> Result(Dir);
224-
llvm::sys::fs::make_absolute(Result);
224+
FileMgr.makeAbsolutePath(Result);
225225
if (ModuleName.contains(':'))
226226
// The separator of C++20 modules partitions (':') is not good for file
227227
// systems, here clang and gcc choose '-' by default since it is not a
@@ -246,7 +246,7 @@ std::string HeaderSearch::getPrebuiltImplicitModuleFileName(Module *Module) {
246246
StringRef ModuleCacheHash = HSOpts.DisableModuleHash ? "" : getModuleHash();
247247
for (const std::string &Dir : HSOpts.PrebuiltModulePaths) {
248248
SmallString<256> CachePath(Dir);
249-
llvm::sys::fs::make_absolute(CachePath);
249+
FileMgr.makeAbsolutePath(CachePath);
250250
llvm::sys::path::append(CachePath, ModuleCacheHash);
251251
std::string FileName =
252252
getCachedModuleFileNameImpl(ModuleName, ModuleMapPath, CachePath);

0 commit comments

Comments
 (0)