Debian Codegraph @

other/analysis/run-clang-analyze

raw
1 #!/bin/bash
2
3 . other/analysis/gen-file.sh
4
5 set -e
6
7 run() {
8 echo "Running Clang static analyzer in variant '$*'"
9 clang++ --analyze amalgamation.cc \
10 "${CPPFLAGS[@]}" \
11 "$@" \
12 -std=c++20 &
13 local pid=$!
14 local start_time="$(date +%s)"
15 local last_update="$start_time"
16 local timeout=$((30 * 60))
17 local interval=$((5 * 60))
18
19 while kill -0 "$pid" 2>/dev/null; do
20 local current_time="$(date +%s)"
21 if ((current_time - start_time > timeout)); then
22 echo "Timeout reached. Killing process."
23 kill -9 "$pid"
24 wait "$pid"
25 return 1
26 fi
27
28 if ((current_time - last_update > interval)); then
29 echo "Still running..."
30 last_update=$current_time
31 fi
32 sleep 1
33 done
34
35 wait "$pid"
36 }
37
38 . other/analysis/variants.sh