From e78d62af91cd264347f9b743f52d57bb999ec20c Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sat, 24 Oct 2015 22:42:42 +0200 Subject: find-expert-in-tree: add usage --- one-off/find-expert-in-tree | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/one-off/find-expert-in-tree b/one-off/find-expert-in-tree index 5c5631b..59e3d24 100755 --- a/one-off/find-expert-in-tree +++ b/one-off/find-expert-in-tree @@ -1,6 +1,14 @@ #!/bin/bash # Searches for functions adding expert items which are located in a if(tree) # guard. Tested using clang-query 3.7.0 (part of clang-tools-extra). +# +# Usage: +# +# Ensure that builddir and srcdir variables below are set +# Ensure that compile_commands.json exists in builddir (see below). +# Run `./find-expert-in-tree > scan.log` to write matching contexts to file +# Use the displayed awk command for further processing (see bottom). +# # Author: Peter Wu # path to builddir (should contain compile_commands.json, use @@ -91,7 +99,8 @@ xargs -rt -P$(nproc) -n10 clang-query "${args[@]}" # -n limits files per command. Use this to tune memory usage. rm "$tmp" -cat <<'EOF' +cat <<'EOF' >&2 + # Use this for analysis: awk '/"[r]oot" binds here/{i=3} !/clang-query/&&i>0{printf("%s\033[m\n", $0);i--}' scan.log | less -r EOF -- cgit v1.2.1