MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / find_llvm_tool

Function find_llvm_tool

scripts/coverage.rs:216–239  ·  view source on GitHub ↗
(name: &str)

Source from the content-addressed store, hash-verified

214}
215
216fn find_llvm_tool(name: &str) -> PathBuf {
217 let output = Command::new("rustc")
218 .arg("--print")
219 .arg("sysroot")
220 .output()
221 .expect("failed to run rustc --print sysroot");
222 let sysroot = String::from_utf8(output.stdout)
223 .expect("non-utf8 sysroot")
224 .trim()
225 .to_string();
226
227 let rustlib = Path::new(&sysroot).join("lib").join("rustlib");
228 if let Ok(entries) = fs::read_dir(&rustlib) {
229 for entry in entries.flatten() {
230 let candidate = entry.path().join("bin").join(name);
231 if candidate.exists() {
232 return candidate;
233 }
234 }
235 }
236
237 eprintln!("warning: {name} not found in rustup sysroot, trying PATH");
238 PathBuf::from(name)
239}
240
241fn has_command(name: &str) -> bool {
242 Command::new(name)

Callers 1

mainFunction · 0.85

Calls 11

read_dirFunction · 0.85
fromFunction · 0.85
outputMethod · 0.80
flattenMethod · 0.80
existsMethod · 0.80
newFunction · 0.50
expectMethod · 0.45
argMethod · 0.45
to_stringMethod · 0.45
joinMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected