Skip to content

Commit fe4fb79

Browse files
committed
add coverage for llvm-config path resolution
Signed-off-by: onur-ozkan <[email protected]>
1 parent 4b8b18f commit fe4fb79

File tree

2 files changed

+438
-227
lines changed

2 files changed

+438
-227
lines changed

src/bootstrap/src/core/build_steps/llvm.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ impl LlvmBuildStatus {
5454
LlvmBuildStatus::ShouldBuild(_) => true,
5555
}
5656
}
57+
58+
#[cfg(test)]
59+
pub fn llvm_result(&self) -> &LlvmResult {
60+
match self {
61+
LlvmBuildStatus::AlreadyBuilt(res) => res,
62+
LlvmBuildStatus::ShouldBuild(meta) => &meta.res,
63+
}
64+
}
5765
}
5866

5967
/// Linker flags to pass to LLVM's CMake invocation.
@@ -120,12 +128,17 @@ pub fn prebuilt_llvm_config(
120128
let root = "src/llvm-project/llvm";
121129
let out_dir = builder.llvm_out(target);
122130

123-
let build_llvm_config = if target == builder.config.build {
131+
let build_llvm_config = if let Some(build_llvm_config) = builder
132+
.config
133+
.target_config
134+
.get(&builder.config.build)
135+
.and_then(|config| config.llvm_config.clone())
136+
{
137+
build_llvm_config
138+
} else {
124139
let mut llvm_config_ret_dir = builder.llvm_out(builder.config.build);
125140
llvm_config_ret_dir.push("bin");
126141
llvm_config_ret_dir.join(exe("llvm-config", builder.config.build))
127-
} else {
128-
builder.ensure(Llvm { target: builder.config.build }).llvm_config
129142
};
130143

131144
let llvm_cmake_dir = out_dir.join("lib/cmake/llvm");

0 commit comments

Comments
 (0)