forked from joshkunz/ashuffle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-clang-tidy
More file actions
executable file
·27 lines (19 loc) · 896 Bytes
/
run-clang-tidy
File metadata and controls
executable file
·27 lines (19 loc) · 896 Bytes
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
#!/bin/sh
cp "${MESON_BUILD_ROOT}/compile_commands.json" "${MESON_BUILD_ROOT}/compile_commands.json.orig"
# meson generates a `-pipe` flag for some reason, which clang chokes on.
sed -iE 's/-pipe//g' "${MESON_BUILD_ROOT}/compile_commands.json"
if test $? -ne 0; then
echo "failed edit compile commands" >&2
exit 1
fi
cat "${MESON_BUILD_ROOT}/compile_commands.json" | jq '
[.[] | select(.file | test(".*subprojects/.*") | not)]
' > "${MESON_BUILD_ROOT}/compile_commands.json.fixed"
cp "${MESON_BUILD_ROOT}/compile_commands.json.fixed" "${MESON_BUILD_ROOT}/compile_commands.json"
rm "${MESON_BUILD_ROOT}/compile_commands.json.fixed"
CLANG_TIDY="${CLANG_TIDY:-clang-tidy}"
"${CLANG_TIDY}" -p "${MESON_BUILD_ROOT}" "$@"
code=$?
# restore the original compile commands.
mv "${MESON_BUILD_ROOT}/compile_commands.json.orig" "${MESON_BUILD_ROOT}/compile_commands.json"
exit "${code}"