File: clang_tidy.sh

package info (click to toggle)
ispc 1.26.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 95,356 kB
  • sloc: cpp: 55,778; python: 6,681; yacc: 3,074; lex: 1,095; ansic: 714; sh: 283; makefile: 16
file content (37 lines) | stat: -rwxr-xr-x 1,035 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
#  Copyright (c) 2024, Intel Corporation
#  SPDX-License-Identifier: BSD-3-Clause

set -e

BUILD_FOLDER=${1:-"build"}

if [ ! -d "$BUILD_FOLDER" ]; then
  echo "Build folder '$BUILD_FOLDER' does not exist."
  exit 1
fi

if [ ! -f "$BUILD_FOLDER/compile_commands.json" ]; then
  echo "compile_commands.json not found in '$BUILD_FOLDER'."
  exit 1
fi

CLANG_TIDY=${2:-"clang-tidy-18"}
if ! command -v $CLANG_TIDY &> /dev/null; then
  echo "$CLANG_TIDY not found. Please install clang-tidy-18."
  exit 1
else
  CLANG_TIDY_PATH=$(which $CLANG_TIDY)
  echo "Using clang-tidy: $CLANG_TIDY_PATH"
  "$CLANG_TIDY_PATH" --version
fi

FILES=$(ls                                  \
    src/*.{cpp,h}                           \
    src/opt/*.{cpp,h}                       \
    builtins/*{cpp,hpp,c}                   \
    common/*.h                              \
)

# Run clang-tidy with the compilation database from the given build folder in parallel
run-clang-tidy -clang-tidy-binary "$CLANG_TIDY_PATH" -p "$BUILD_FOLDER" $FILES