1
Fork 0

Fix incorrect NDEBUG handling in LLVM bindings

We currently compile our LLVM bindings using `-DNDEBUG` if
debuginfo for LLVM is disabled. However, `NDEBUG` doesn't have
any relation to debuginfo, it controls whether assertions are
enabled.

Rename the environment variable to `LLVM_ASSERTIONS` and drive
it using the `llvm_assertions` option. Also drop the explicit
`debug(false)` call, as cc already sets this up using the
cargo `DEBUG` environment variable.
This commit is contained in:
Nikita Popov 2024-07-12 14:48:42 +02:00 committed by Nikita Popov
parent 0fdfb61795
commit 776b0adaaf
2 changed files with 3 additions and 4 deletions

View file

@ -197,9 +197,8 @@ fn main() {
cfg.define("LLVM_RUSTLLVM", None);
}
if tracked_env_var_os("LLVM_NDEBUG").is_some() {
if tracked_env_var_os("LLVM_ASSERTIONS").is_none() {
cfg.define("NDEBUG", None);
cfg.debug(false);
}
rerun_if_changed_anything_in_dir(Path::new("llvm-wrapper"));