diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 775f3f029861c..d86f47bada86b 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -192,7 +192,12 @@ std::string Driver::GetResourcesPath(StringRef BinaryPath) { StringRef ConfiguredResourceDir(CLANG_RESOURCE_DIR); if (!ConfiguredResourceDir.empty()) { - llvm::sys::path::append(P, ConfiguredResourceDir); + // FIXME: We should fix the behavior of llvm::sys::path::append so we don't + // need to check for absolute paths here. + if (llvm::sys::path::is_absolute(ConfiguredResourceDir)) + P = ConfiguredResourceDir; + else + llvm::sys::path::append(P, ConfiguredResourceDir); } else { // On Windows, libclang.dll is in bin/. // On non-Windows, libclang.so/.dylib is in lib/. diff --git a/llvm/include/llvm/Support/Path.h b/llvm/include/llvm/Support/Path.h index 0d8881359b806..0cb517146c04b 100644 --- a/llvm/include/llvm/Support/Path.h +++ b/llvm/include/llvm/Support/Path.h @@ -223,6 +223,8 @@ LLVM_ABI bool remove_dots(SmallVectorImpl &path, /// /foo + bar/f => /foo/bar/f /// /foo/ + bar/f => /foo/bar/f /// foo + bar/f => foo/bar/f +/// foo + /bar/f => foo/bar/f (FIXME: will be changed to /bar/f to align +/// with C++17 std::filesystem::path::append) /// @endcode /// /// @param path Set to \a path + \a component.