@@ -68,21 +68,24 @@ crate_name=name_of_the_tested_crate_in_snake_case
68
68
objects=()
69
69
IFS=$' \n '
70
70
for file in $(
71
- CARGO_HOST_RUSTFLAGS=--cfg=wasm_bindgen_unstable_test_coverage \
72
- RUSTFLAGS=" -Cinstrument-coverage -Zno-profiler-runtime --emit=llvm-ir --cfg=wasm_bindgen_unstable_test_coverage" \
73
- cargo +nightly test -Ztarget-applies-to-host -Zhost-config --tests --no-run --message-format=json | \
74
- jq -r " select(.reason == \" compiler-artifact\" ) | (select(.target.kind == [\" test\" ]) // select(.target.name == \" $crate_name \" )) | .filenames[0]"
71
+ CARGO_HOST_RUSTFLAGS=--cfg=wasm_bindgen_unstable_test_coverage \
72
+ RUSTFLAGS=" -Cinstrument-coverage -Zno-profiler-runtime --emit=llvm-ir --cfg=wasm_bindgen_unstable_test_coverage" \
73
+ cargo +nightly test -Ztarget-applies-to-host -Zhost-config --tests --no-run --message-format=json | \
74
+ jq -r " select(.reason == \" compiler-artifact\" ) | (select(.target.kind == [\" test\" ]) // select(.target.name == \" $crate_name \" )) | .filenames[0]"
75
75
)
76
76
do
77
- if [[ ${file##* .} == " rlib" ]]; then
78
- base=$( basename $file .rlib)
79
- file=$( dirname $file ) /${base# " lib" } .ll
80
- else
81
- file=$( dirname $file ) /$( basename $file .wasm) .ll
82
- fi
83
-
84
- perl -i -p0e ' s/(^define.*?$).*?^}/$1\nstart:\n unreachable\n}/gms' $file
85
- perl -i -p0e ' s/(^define( [^ ]+)*) range\(.*?\)/$1/gm' $file
77
+ if [[ ${file##* .} == " rlib" ]]; then
78
+ base=$( basename $file .rlib)
79
+ file=$( dirname $file ) /${base# " lib" } .ll
80
+ else
81
+ file=$( dirname $file ) /$( basename $file .wasm) .ll
82
+ fi
83
+
84
+ perl -i -p0e ' s/(^define.*?$).*?^}/$1\nstart:\n unreachable\n}/gms' $file
85
+ counter=1
86
+ while (( counter != 0 )) ; do
87
+ counter=$( perl -i -p0e ' $c+= s/(^(define|declare)(,? [^\n ]+)*),? range\(.*?\)/$1/gm; END{print "$c"}' $file )
88
+ done
86
89
87
90
output = $( basename $file .ll) .o
88
91
clang-18 $input -Wno-override-module -c -o $output
0 commit comments