From 513ab0cb2c000b5613c6660259a31a7de48ef9d2 Mon Sep 17 00:00:00 2001 From: Harald Alvestrand Date: Tue, 23 May 2023 10:18:36 +0000 Subject: [PATCH] Add a -d option to apply-iwyu This allows users to turn debugging on from the command line instead of modifying the file. Bug: None Change-Id: I37d42a8b745f60720e5b396d695d3b2dda444b8b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/306222 Commit-Queue: Harald Alvestrand Reviewed-by: Mirko Bonadei Cr-Commit-Position: refs/heads/main@{#40196} --- tools_webrtc/iwyu/apply-iwyu | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools_webrtc/iwyu/apply-iwyu b/tools_webrtc/iwyu/apply-iwyu index afa611e4fe..3a20ff3551 100755 --- a/tools_webrtc/iwyu/apply-iwyu +++ b/tools_webrtc/iwyu/apply-iwyu @@ -15,6 +15,7 @@ # # To get iwyu on Debian/glinux, do "sudo apt-get install iwyu". +# Debug level, also controlled by the "-d" argument. # Set this to 1 to get more debug information. # Set this to 2 to also get a dump of the iwyu tool output. DEBUG=0 @@ -54,15 +55,17 @@ usage() { echo "Arguments:" echo " -c compile-commands: Compiler command file" echo " -r : Remove non-required includes from .h file" + echo " -d : Set debug level to " echo " -h : Print this help message" echo "(default command file: out/Default/compile_commands.json - this" echo "will be generated if not present" } -while getopts 'c:rh' opts; do +while getopts 'c:d:rh' opts; do case "${opts}" in c) COMPILE_COMMANDS="${OPTARG}" ;; r) FIX_INCLUDE_ARGS="${FIX_INCLUDE_ARGS} --nosafe_headers" ;; + d) DEBUG=${OPTARG};if [ $DEBUG -gt 0 ]; then set -x; fi ;; h) usage; exit 1 ;; *) error "Unexpected option ${opts}" ;; esac