|
3 | 3 |
|
4 | 4 | use serde::{Deserialize, Deserializer};
|
5 | 5 |
|
| 6 | +use crate::core::config::StringOrBool; |
6 | 7 | use crate::core::config::toml::{Merge, ReplaceOpt, TomlConfig};
|
7 |
| -use crate::core::config::{StringOrBool, set}; |
8 |
| -use crate::{Config, HashMap, HashSet, PathBuf, define_config, exit}; |
| 8 | +use crate::{HashMap, HashSet, PathBuf, define_config, exit}; |
9 | 9 |
|
10 | 10 | define_config! {
|
11 | 11 | /// TOML representation of how the LLVM build is configured.
|
| 12 | + #[derive(Default)] |
12 | 13 | struct Llvm {
|
13 | 14 | optimize: Option<bool> = "optimize",
|
14 | 15 | thin_lto: Option<bool> = "thin-lto",
|
@@ -144,127 +145,3 @@ pub fn check_incompatible_options_for_ci_llvm(
|
144 | 145 |
|
145 | 146 | Ok(())
|
146 | 147 | }
|
147 |
| - |
148 |
| -impl Config { |
149 |
| - pub fn apply_llvm_config(&mut self, toml_llvm: Option<Llvm>) { |
150 |
| - let mut llvm_tests = None; |
151 |
| - let mut llvm_enzyme = None; |
152 |
| - let mut llvm_offload = None; |
153 |
| - let mut llvm_plugins = None; |
154 |
| - |
155 |
| - if let Some(llvm) = toml_llvm { |
156 |
| - let Llvm { |
157 |
| - optimize: optimize_toml, |
158 |
| - thin_lto, |
159 |
| - release_debuginfo, |
160 |
| - assertions: _, |
161 |
| - tests, |
162 |
| - enzyme, |
163 |
| - plugins, |
164 |
| - static_libstdcpp, |
165 |
| - libzstd, |
166 |
| - ninja, |
167 |
| - targets, |
168 |
| - experimental_targets, |
169 |
| - link_jobs, |
170 |
| - link_shared, |
171 |
| - version_suffix, |
172 |
| - clang_cl, |
173 |
| - cflags, |
174 |
| - cxxflags, |
175 |
| - ldflags, |
176 |
| - use_libcxx, |
177 |
| - use_linker, |
178 |
| - allow_old_toolchain, |
179 |
| - offload, |
180 |
| - polly, |
181 |
| - clang, |
182 |
| - enable_warnings, |
183 |
| - download_ci_llvm, |
184 |
| - build_config, |
185 |
| - } = llvm; |
186 |
| - |
187 |
| - set(&mut self.ninja_in_file, ninja); |
188 |
| - llvm_tests = tests; |
189 |
| - llvm_enzyme = enzyme; |
190 |
| - llvm_offload = offload; |
191 |
| - llvm_plugins = plugins; |
192 |
| - set(&mut self.llvm_optimize, optimize_toml); |
193 |
| - set(&mut self.llvm_thin_lto, thin_lto); |
194 |
| - set(&mut self.llvm_release_debuginfo, release_debuginfo); |
195 |
| - set(&mut self.llvm_static_stdcpp, static_libstdcpp); |
196 |
| - set(&mut self.llvm_libzstd, libzstd); |
197 |
| - if let Some(v) = link_shared { |
198 |
| - self.llvm_link_shared.set(Some(v)); |
199 |
| - } |
200 |
| - self.llvm_targets.clone_from(&targets); |
201 |
| - self.llvm_experimental_targets.clone_from(&experimental_targets); |
202 |
| - self.llvm_link_jobs = link_jobs; |
203 |
| - self.llvm_version_suffix.clone_from(&version_suffix); |
204 |
| - self.llvm_clang_cl.clone_from(&clang_cl); |
205 |
| - |
206 |
| - self.llvm_cflags.clone_from(&cflags); |
207 |
| - self.llvm_cxxflags.clone_from(&cxxflags); |
208 |
| - self.llvm_ldflags.clone_from(&ldflags); |
209 |
| - set(&mut self.llvm_use_libcxx, use_libcxx); |
210 |
| - self.llvm_use_linker.clone_from(&use_linker); |
211 |
| - self.llvm_allow_old_toolchain = allow_old_toolchain.unwrap_or(false); |
212 |
| - self.llvm_offload = offload.unwrap_or(false); |
213 |
| - self.llvm_polly = polly.unwrap_or(false); |
214 |
| - self.llvm_clang = clang.unwrap_or(false); |
215 |
| - self.llvm_enable_warnings = enable_warnings.unwrap_or(false); |
216 |
| - self.llvm_build_config = build_config.clone().unwrap_or(Default::default()); |
217 |
| - |
218 |
| - self.llvm_from_ci = self.parse_download_ci_llvm(download_ci_llvm, self.llvm_assertions); |
219 |
| - |
220 |
| - if self.llvm_from_ci { |
221 |
| - let warn = |option: &str| { |
222 |
| - println!( |
223 |
| - "WARNING: `{option}` will only be used on `compiler/rustc_llvm` build, not for the LLVM build." |
224 |
| - ); |
225 |
| - println!( |
226 |
| - "HELP: To use `{option}` for LLVM builds, set `download-ci-llvm` option to false." |
227 |
| - ); |
228 |
| - }; |
229 |
| - |
230 |
| - if static_libstdcpp.is_some() { |
231 |
| - warn("static-libstdcpp"); |
232 |
| - } |
233 |
| - |
234 |
| - if link_shared.is_some() { |
235 |
| - warn("link-shared"); |
236 |
| - } |
237 |
| - |
238 |
| - // FIXME(#129153): instead of all the ad-hoc `download-ci-llvm` checks that follow, |
239 |
| - // use the `builder-config` present in tarballs since #128822 to compare the local |
240 |
| - // config to the ones used to build the LLVM artifacts on CI, and only notify users |
241 |
| - // if they've chosen a different value. |
242 |
| - |
243 |
| - if libzstd.is_some() { |
244 |
| - println!( |
245 |
| - "WARNING: when using `download-ci-llvm`, the local `llvm.libzstd` option, \ |
246 |
| - like almost all `llvm.*` options, will be ignored and set by the LLVM CI \ |
247 |
| - artifacts builder config." |
248 |
| - ); |
249 |
| - println!( |
250 |
| - "HELP: To use `llvm.libzstd` for LLVM/LLD builds, set `download-ci-llvm` option to false." |
251 |
| - ); |
252 |
| - } |
253 |
| - } |
254 |
| - |
255 |
| - if !self.llvm_from_ci && self.llvm_thin_lto && link_shared.is_none() { |
256 |
| - // If we're building with ThinLTO on, by default we want to link |
257 |
| - // to LLVM shared, to avoid re-doing ThinLTO (which happens in |
258 |
| - // the link step) with each stage. |
259 |
| - self.llvm_link_shared.set(Some(true)); |
260 |
| - } |
261 |
| - } else { |
262 |
| - self.llvm_from_ci = self.parse_download_ci_llvm(None, false); |
263 |
| - } |
264 |
| - |
265 |
| - self.llvm_tests = llvm_tests.unwrap_or(false); |
266 |
| - self.llvm_enzyme = llvm_enzyme.unwrap_or(false); |
267 |
| - self.llvm_offload = llvm_offload.unwrap_or(false); |
268 |
| - self.llvm_plugins = llvm_plugins.unwrap_or(false); |
269 |
| - } |
270 |
| -} |
0 commit comments