Skip to content

Commit 5c15ede

Browse files
author
Kjetil Kjeka
committed
LlvmBitcodeLinker: Better error messages when llvm-tools cannot be found
1 parent 503d8f0 commit 5c15ede

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/tools/llvm-bitcode-linker/src/linker.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl Session {
6262
.arg("-o")
6363
.arg(&self.link_path)
6464
.output()
65-
.unwrap();
65+
.context("An error occured when calling llvm-link. Make sure the llvm-tools component is installed.")?;
6666

6767
if !llvm_link_output.status.success() {
6868
tracing::error!(
@@ -108,7 +108,9 @@ impl Session {
108108
opt_cmd.arg("--strip-debug");
109109
}
110110

111-
let opt_output = opt_cmd.output().unwrap();
111+
let opt_output = opt_cmd.output().context(
112+
"An error occured when calling opt. Make sure the llvm-tools component is installed.",
113+
)?;
112114

113115
if !opt_output.status.success() {
114116
tracing::error!(
@@ -133,8 +135,11 @@ impl Session {
133135
lcc_command.arg("--mcpu").arg(mcpu);
134136
}
135137

136-
let lcc_output =
137-
lcc_command.arg(&self.opt_path).arg("-o").arg(&self.out_path).output().unwrap();
138+
let lcc_output = lcc_command
139+
.arg(&self.opt_path)
140+
.arg("-o").arg(&self.out_path)
141+
.output()
142+
.context("An error occured when calling llc. Make sure the llvm-tools component is installed.")?;
138143

139144
if !lcc_output.status.success() {
140145
tracing::error!(

0 commit comments

Comments
 (0)