Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5194,7 +5194,10 @@ void Clang::ConstructHostCompilerJob(Compilation &C, const JobAction &JA,
if (HostCompilerDefArg) {
ExecPath = HostCompilerDefArg->getValue();
if (!ExecPath.empty() && ExecPath == llvm::sys::path::stem(ExecPath))
ExecPath = TC.GetProgramPath(ExecPath.c_str());
// Use PATH to find executable.
if (llvm::ErrorOr<std::string> Prog =
llvm::sys::findProgramByName(ExecPath))
ExecPath = *Prog;
}

// Add any user-specified arguments.
Expand Down
10 changes: 10 additions & 0 deletions clang/test/Driver/sycl-host-compiler-old-model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,13 @@
// CHECK_SAVE_TEMPS-NEXT: g++{{.*}} "[[APPEND_CPP]]" "-c"
// CHECK_SAVE_TEMPS-SAME: "-o" "[[HOST_OBJ:.+\.o]]"
// CHECK_SAVE_TEMPS-NEXT: clang-offload-bundler{{.*}} "-input=[[DEVICE_BC]]" "-input=[[HOST_OBJ]]"

/// Test to verify binary from PATH is used
// RUN: rm -rf %t && mkdir -p %t/test_path
// RUN: touch %t/test_path/clang++ && chmod +x %t/test_path/clang++
// RUN: env PATH=%t/test_path \
// RUN: %clangxx -### -fsycl -fsycl-host-compiler=clang++ \
// RUN: -fsycl-host-compiler-options=-DDUMMY_OPT --no-offload-new-driver \
// RUN: %s 2>&1 \
// RUN: | FileCheck -check-prefix=PATH_CHECK %s
// PATH_CHECK: {{(/|\\\\)}}test_path{{(/|\\\\)}}clang++{{.*}} "-DDUMMY_OPT"
Loading