Skip to content

clang-tools support in tools

Ian Rogers bpf linux-perf-users lkml llvm 3 versions – Applied

Status from this message: Applied to perf-tools-next, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest18 patches 2 repliesApplied
  2. v218 patches 14 repliesSuperseded
  3. v118 patches 8 repliesSuperseded

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/18gen_compile_commands: Allow the line prefix to still be cmd_scripts/clang-tools/gen_compile_commands.py+3 -30 replies
2/18gen_compile_commands: Sort output compile commands by file namescripts/clang-tools/gen_compile_commands.py+1 -10 replies
3/18run-clang-tools: Add pass through checks and and header-filter argumentsscripts/clang-tools/run-clang-tools.py+25 -70 replies
3/18run-clang-tools: Add pass through checks and header-filter argumentsscripts/clang-tools/run-clang-tools.py+25 -70 replies
4/18perf bench uprobe: Fix potential use of memory after freetools/perf/bench/uprobe.c+1 -00 replies
5/18perf buildid-cache: Fix use of uninitialized valuetools/perf/builtin-buildid-cache.c+4 -20 replies
6/18perf env: Remove unnecessary NULL teststools/perf/util/env.c+3 -30 replies
7/18perf jitdump: Avoid memory leaktools/perf/util/jitdump.c+1 -00 replies
8/18perf mem-events: Avoid uninitialized readtools/perf/util/mem-events.c+2 -10 replies
9/18perf dlfilter: Be defensive against potential NULL dereferencetools/perf/util/dlfilter.c+3 -10 replies
10/18perf hists browser: Reorder variables to reduce paddingtools/perf/ui/browsers/hists.c+2 -20 replies
11/18perf hists browser: Avoid potential NULL dereferencetools/perf/ui/browsers/hists.c+1 -10 replies
12/18perf svghelper: Avoid memory leaktools/perf/util/svghelper.c+3 -20 replies
13/18perf lock: Fix a memory leak on an error pathtools/perf/builtin-lock.c+1 -00 replies
14/18perf parse-events: Fix unlikely memory leak when cloning termstools/perf/util/parse-events.c+3 -10 replies
15/18tools api: Avoid potential double freetools/lib/api/io.h+1 -00 replies
16/18perf trace-event-info: Avoid passing NULL value to closedirtools/perf/util/trace-event-info.c+2 -10 replies
17/18perf header: Fix various error path memory leakstools/perf/util/header.c+34 -260 replies
18/18perf bpf_counter: Fix a few memory leakstools/perf/util/bpf_counter.c+4 -10 replies

Reviews trailers per patch

4 of 19 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchNick DesaulniersNamhyung Kim
SeriesA-b
1/18R-b
2/18R-b
3/18R-b R-b
3/18R-b R-b
4/18
5/18
6/18
7/18
8/18
9/18
10/18
11/18
12/18
13/18
14/18
15/18
16/18
17/18
18/18

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 00/18] clang-tools support in tools

Allow the clang-tools scripts to work with builds in tools such as tools/perf and tools/lib/perf. An example use looks like:

```
$ cd tools/perf
$ make CC=clang CXX=clang++
$ ../../scripts/clang-tools/gen_compile_commands.py
$ ../../scripts/clang-tools/run-clang-tools.py clang-tidy compile_commands.json -checks=-*,readability-named-parameter
Skipping non-C file: 'tools/perf/bench/mem-memcpy-x86-64-asm.S'
Skipping non-C file: 'tools/perf/bench/mem-memset-x86-64-asm.S'
Skipping non-C file: 'tools/perf/arch/x86/tests/regs_load.S'
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
tools/perf/util/parse-events-flex.c:546:27: warning: all parameters should be named in a function [readability-named-parameter]
void *yyalloc ( yy_size_t , yyscan_t yyscanner );
                          ^
                           /*size*/
...
```

Fix a number of the more serious low-hanging issues in perf found by clang-tidy.

This support isn't complete, in particular it doesn't support output directories properly and so fails for tools/lib/bpf, tools/bpf/bpftool and if an output directory is used.

v3. Add Nick Desaulniers reviewed-by to patch 3. For Namhyung, drop
"perf hisi-ptt: Fix potential memory leak", split lock change out of "perf svghelper: Avoid memory leak" and address comments in "perf header: Fix various error path memory leaks".
v2: Address comments by Nick Desaulniers in patch 3, and add their
Reviewed-by to patches 1 and 2.

Ian Rogers (18):
gen_compile_commands: Allow the line prefix to still be cmd_
gen_compile_commands: Sort output compile commands by file name
run-clang-tools: Add pass through checks and header-filter arguments perf bench uprobe: Fix potential use of memory after free perf buildid-cache: Fix use of uninitialized value
perf env: Remove unnecessary NULL tests
perf jitdump: Avoid memory leak
perf mem-events: Avoid uninitialized read
perf dlfilter: Be defensive against potential NULL dereference perf hists browser: Reorder variables to reduce padding perf hists browser: Avoid potential NULL dereference
perf svghelper: Avoid memory leak
perf lock: Fix a memory leak on an error path
perf parse-events: Fix unlikely memory leak when cloning terms tools api: Avoid potential double free
perf trace-event-info: Avoid passing NULL value to closedir perf header: Fix various error path memory leaks
perf bpf_counter: Fix a few memory leaks

 scripts/clang-tools/gen_compile_commands.py |  8 +--
 scripts/clang-tools/run-clang-tools.py      | 32 ++++++++---
 tools/lib/api/io.h                          |  1 +
 tools/perf/bench/uprobe.c                   |  1 +
 tools/perf/builtin-buildid-cache.c          |  6 ++-
 tools/perf/builtin-lock.c                   |  1 +
 tools/perf/ui/browsers/hists.c              |  6 +--
 tools/perf/util/bpf_counter.c               |  5 +-
 tools/perf/util/dlfilter.c                  |  4 +-
 tools/perf/util/env.c                       |  6 +--
 tools/perf/util/header.c                    | 60 ++++++++++++---------
 tools/perf/util/jitdump.c                   |  1 +
 tools/perf/util/mem-events.c                |  3 +-
 tools/perf/util/parse-events.c              |  4 +-
 tools/perf/util/svghelper.c                 |  5 +-
 tools/perf/util/trace-event-info.c          |  3 +-
 16 files changed, 94 insertions(+), 52 deletions(-)
Signature · 1 line
2.42.0.609.gbb76f46606-goog