Skip to content

Commit

Permalink
Prefer plain scan-build-py command if available
Browse files Browse the repository at this point in the history
Debian added the symlink with llvm-defaults 0.61 [1], in Sid as of
this writing.

[1] https://tracker.debian.org/news/1576545/accepted-llvm-defaults-061-source-into-unstable/
  • Loading branch information
airtower-luna committed Oct 18, 2024
1 parent d709618 commit 1eb089f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions support/scan-build-wrapper.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
#!/bin/sh

# find the current default LLVM version and its scan-build-py
llvm_version="$(readlink $(command -v scan-build) | cut -d '-' -f 3)"
SCAN_BUILD_PY="$(command -v scan-build-py-${llvm_version})"
bin="scan-build-py"
SCAN_BUILD_PY="$(command -v ${bin})"
if [ -z "${SCAN_BUILD_PY}" ]; then
# find the current default LLVM version and its scan-build-py
llvm_version="$(readlink $(command -v scan-build) | cut -d '-' -f 3)"
SCAN_BUILD_PY="$(command -v ${bin}-${llvm_version})"
fi

if [ -z "${SCAN_BUILD_PY}" ]; then
echo "ERROR: ${bin} not found!" >&2
exit 1
fi

# run it to produce SARIF and HTML output with Clang
exec "${SCAN_BUILD_PY}" --sarif-html --use-cc=clang "$@"

0 comments on commit 1eb089f

Please sign in to comment.