bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/18] clang-tools support in tools
@ 2023-10-05 23:08 Ian Rogers
  2023-10-05 23:08 ` [PATCH v2 01/18] gen_compile_commands: Allow the line prefix to still be cmd_ Ian Rogers
                   ` (17 more replies)
  0 siblings, 18 replies; 33+ messages in thread
From: Ian Rogers @ 2023-10-05 23:08 UTC (permalink / raw)
  To: Nathan Chancellor, Nick Desaulniers, Tom Rix, Peter Zijlstra,
	Ingo Molnar, Arnaldo Carvalho de Melo, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Namhyung Kim, Ian Rogers,
	Adrian Hunter, Yicong Yang, Jonathan Cameron, Yang Jihong,
	Kan Liang, Ming Wang, Huacai Chen, Sean Christopherson,
	K Prateek Nayak, Yanteng Si, Yuan Can, Ravi Bangoria,
	James Clark, llvm, linux-kernel, linux-perf-users, bpf

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.

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 and header-filter
    arguments
  perf hisi-ptt: Fix potential memory leak
  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 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                    | 63 +++++++++++++--------
 tools/perf/util/hisi-ptt.c                  | 12 ++--
 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 +-
 17 files changed, 104 insertions(+), 57 deletions(-)

-- 
2.42.0.609.gbb76f46606-goog


^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2023-10-09 17:13 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-05 23:08 [PATCH v2 00/18] clang-tools support in tools Ian Rogers
2023-10-05 23:08 ` [PATCH v2 01/18] gen_compile_commands: Allow the line prefix to still be cmd_ Ian Rogers
2023-10-05 23:08 ` [PATCH v2 02/18] gen_compile_commands: Sort output compile commands by file name Ian Rogers
2023-10-05 23:08 ` [PATCH v2 03/18] run-clang-tools: Add pass through checks and and header-filter arguments Ian Rogers
2023-10-06 21:22   ` Nick Desaulniers
2023-10-05 23:08 ` [PATCH v2 04/18] perf hisi-ptt: Fix potential memory leak Ian Rogers
2023-10-09  5:41   ` Namhyung Kim
2023-10-09 15:45     ` Ian Rogers
2023-10-05 23:08 ` [PATCH v2 05/18] perf bench uprobe: Fix potential use of memory after free Ian Rogers
2023-10-09  5:51   ` Namhyung Kim
2023-10-09 16:13     ` Ian Rogers
2023-10-05 23:08 ` [PATCH v2 06/18] perf buildid-cache: Fix use of uninitialized value Ian Rogers
2023-10-09  6:06   ` Namhyung Kim
2023-10-09 16:22     ` Ian Rogers
2023-10-05 23:08 ` [PATCH v2 07/18] perf env: Remove unnecessary NULL tests Ian Rogers
2023-10-09  6:14   ` Namhyung Kim
2023-10-09 16:33     ` Ian Rogers
2023-10-05 23:08 ` [PATCH v2 08/18] perf jitdump: Avoid memory leak Ian Rogers
2023-10-05 23:08 ` [PATCH v2 09/18] perf mem-events: Avoid uninitialized read Ian Rogers
2023-10-05 23:08 ` [PATCH v2 10/18] perf dlfilter: Be defensive against potential NULL dereference Ian Rogers
2023-10-09  6:21   ` Namhyung Kim
2023-10-05 23:08 ` [PATCH v2 11/18] perf hists browser: Reorder variables to reduce padding Ian Rogers
2023-10-05 23:08 ` [PATCH v2 12/18] perf hists browser: Avoid potential NULL dereference Ian Rogers
2023-10-05 23:08 ` [PATCH v2 13/18] perf svghelper: Avoid memory leak Ian Rogers
2023-10-09  6:31   ` Namhyung Kim
2023-10-09 16:37     ` Ian Rogers
2023-10-05 23:08 ` [PATCH v2 14/18] perf parse-events: Fix unlikely memory leak when cloning terms Ian Rogers
2023-10-05 23:08 ` [PATCH v2 15/18] tools api: Avoid potential double free Ian Rogers
2023-10-05 23:08 ` [PATCH v2 16/18] perf trace-event-info: Avoid passing NULL value to closedir Ian Rogers
2023-10-05 23:08 ` [PATCH v2 17/18] perf header: Fix various error path memory leaks Ian Rogers
2023-10-09  6:57   ` Namhyung Kim
2023-10-09 17:13     ` Ian Rogers
2023-10-05 23:08 ` [PATCH v2 18/18] perf bpf_counter: Fix a few " Ian Rogers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).