mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-17 15:47:53 +01:00
Use clang-include-cleaner from the llvm clangd package.
Also change the generation of compile_commands.json so that it does not include reclient arguments. Bug: webrtc:15874 Change-Id: I1bc2e7a8768a3467d31528d584f7e70d946a3301 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/347900 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#42110}
This commit is contained in:
parent
4bad933233
commit
89dbc08f36
1 changed files with 26 additions and 7 deletions
|
@ -11,12 +11,31 @@
|
||||||
# "tools/clang/scripts/generate_compdb.py -p path/to/out > compile_commands.json"
|
# "tools/clang/scripts/generate_compdb.py -p path/to/out > compile_commands.json"
|
||||||
# If "out/Default" exists, the script will attempt to generate it for you.
|
# If "out/Default" exists, the script will attempt to generate it for you.
|
||||||
#
|
#
|
||||||
# To get include-cleaner:
|
# clang-include-cleaner is built as part of the "clangd" package in our
|
||||||
# - in google3: define an alias and/or point to it below
|
# LLVM build.
|
||||||
# - in debian distros: sudo apt install clang-tools-17 (or later, and fix below)
|
# Example .gclient file:
|
||||||
# Ignore errors of the type "this argument doesn't exist".
|
# solutions = [
|
||||||
|
# {
|
||||||
|
# "name": "src",
|
||||||
|
# "url": "https://webrtc.googlesource.com/src.git",
|
||||||
|
# "deps_file": "DEPS",
|
||||||
|
# "managed": False,
|
||||||
|
# "custom_deps": {},
|
||||||
|
# "custom_vars" : {
|
||||||
|
# "checkout_clangd": True,
|
||||||
|
# "download_remoteexec_cfg" : True,
|
||||||
|
# }
|
||||||
|
# },
|
||||||
|
# ]
|
||||||
|
|
||||||
CLEANER=/usr/bin/clang-include-cleaner-17
|
|
||||||
|
CLEANER=third_party/llvm-build/Release+Asserts/bin/clang-include-cleaner
|
||||||
|
if [ ! -x $CLEANER ]; then
|
||||||
|
echo "clang-include-cleaner not found"
|
||||||
|
echo -n "Add '\"checkout_clangd\": True' to 'custom_vars' in your"
|
||||||
|
echo ".gclient file and run 'gclient sync'."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Debug level, also controlled by the "-d" argument.
|
# Debug level, also controlled by the "-d" argument.
|
||||||
# Set this to 1 to get more debug information.
|
# Set this to 1 to get more debug information.
|
||||||
|
@ -63,7 +82,7 @@ if [[ -z "$COMPILE_COMMANDS" ]]; then
|
||||||
if [ -d "$WORKDIR" ]; then
|
if [ -d "$WORKDIR" ]; then
|
||||||
if [ ! -f "$WORKDIR/compile_commands.json" ]; then
|
if [ ! -f "$WORKDIR/compile_commands.json" ]; then
|
||||||
echo "Generating compile commands file"
|
echo "Generating compile commands file"
|
||||||
gn gen --export-compile-commands $WORKDIR
|
tools/clang/scripts/generate_compdb.py -p $WORKDIR > $WORKDIR/compile_commands.json
|
||||||
fi
|
fi
|
||||||
COMPILE_COMMANDS="$WORKDIR/compile_commands.json"
|
COMPILE_COMMANDS="$WORKDIR/compile_commands.json"
|
||||||
else
|
else
|
||||||
|
@ -78,7 +97,7 @@ if [ ! -f $FILE ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $WORKDIR
|
cd $WORKDIR
|
||||||
$CLEANER $INCLUDE_ARGS $COMMAND ../../$FILE
|
../../$CLEANER $INCLUDE_ARGS $COMMAND ../../$FILE
|
||||||
|
|
||||||
echo "Finished. Check diff, compile, gn gen --check and git cl format"
|
echo "Finished. Check diff, compile, gn gen --check and git cl format"
|
||||||
echo "before uploading."
|
echo "before uploading."
|
||||||
|
|
Loading…
Reference in a new issue