Skip to content

Commit bf99466

Browse files
committed
Apply windows clang-runtime workaround on clang-20 too
1 parent 4cabf1b commit bf99466

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

binding-generator/src/generator.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,14 +361,22 @@ pub struct Generator {
361361

362362
impl Drop for Generator {
363363
fn drop(&mut self) {
364-
if !(cfg!(windows) && cfg!(feature = "clang-runtime") && clang::get_version().contains(" 19.")) {
365-
// `clang` has an issue on Windows when running with `runtime` feature and clang-19:
364+
const BAD_VERSIONS: [&str; 2] = [" 19.", " 20."];
365+
if !(cfg!(windows)
366+
&& cfg!(feature = "clang-runtime")
367+
&& BAD_VERSIONS
368+
.iter()
369+
.any(|bad_version| clang::get_version().contains(bad_version)))
370+
{
371+
// `clang` has an issue on Windows when running with `runtime` feature and clang-19+:
366372
// https://github.com/KyleMayes/clang-rs/issues/63
367373
// So we avoid dropping clang in that case as a workaround.
368374
// `clang::get_version()` is string like "Apple clang version 15.0.0 (clang-1500.1.0.2.5)"
369375
unsafe {
370376
ManuallyDrop::drop(&mut self.clang);
371377
}
378+
} else {
379+
eprintln!("=== Windows + clang-runtime + clang version is known to be problematic, skipping drop of Generator");
372380
}
373381
}
374382
}

ci/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ elif [[ "$os_family" == "macOS" ]]; then
3131
"$ci_dir/install-macos-framework.sh"
3232
fi
3333
elif [[ "$os_family" == "Windows" ]]; then
34-
export CHOCO_LLVM_VERSION=19.1.5 # https://community.chocolatey.org/packages/llvm#versionhistory
34+
export CHOCO_LLVM_VERSION=20.1.0 # https://community.chocolatey.org/packages/llvm#versionhistory
3535
if [[ "${VCPKG_VERSION:-}" != "" ]]; then # vcpkg build
3636
"$ci_dir/install-windows-vcpkg.sh"
3737
else # chocolatey build

0 commit comments

Comments
 (0)