Skip to content

Commit c113db2

Browse files
authored
Merge pull request #25887 from compnerd/tell-me-whats-wrong
Driver: emit a diagnostic if `clang++` is not found
2 parents 7f9e54d + 133e1f2 commit c113db2

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

lib/Driver/WindowsToolChains.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ toolchains::Windows::constructInvocation(const DynamicLinkJobAction &job,
8080

8181
// Configure the toolchain.
8282
// By default, use the system clang++ to link.
83-
const char *Clang = nullptr;
83+
const char *Clang = "clang++";
8484
if (const Arg *A = context.Args.getLastArg(options::OPT_tools_directory)) {
8585
StringRef toolchainPath(A->getValue());
8686

@@ -89,12 +89,6 @@ toolchains::Windows::constructInvocation(const DynamicLinkJobAction &job,
8989
llvm::sys::findProgramByName("clang++", {toolchainPath}))
9090
Clang = context.Args.MakeArgString(toolchainClang.get());
9191
}
92-
if (Clang == nullptr) {
93-
if (auto pathClang = llvm::sys::findProgramByName("clang++", None))
94-
Clang = context.Args.MakeArgString(pathClang.get());
95-
}
96-
assert(Clang &&
97-
"clang++ was not found in the toolchain directory or system path.");
9892

9993
std::string Target = getTriple().str();
10094
if (!Target.empty()) {

test/Driver/windows-link-job.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// RUN: env PATH= %swiftc_driver_plain -target x86_64-unknown-windows-msvc -### -module-name link -emit-library %s 2>&1 | %FileCheck %s
2+
// CHECK: {{^}}clang++

0 commit comments

Comments
 (0)