Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp194340rdh; Sat, 23 Sep 2023 06:57:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFPK47aH3r+LJ2MDuyfWkduUBaBlrYiwWgWq1lxtzGo2Wnh6hA3Hu1LJ7HlFpZLZEkwqIsF X-Received: by 2002:a17:902:f7d2:b0:1bc:2d43:c747 with SMTP id h18-20020a170902f7d200b001bc2d43c747mr1970464plw.38.1695477460115; Sat, 23 Sep 2023 06:57:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695477460; cv=none; d=google.com; s=arc-20160816; b=sRoVu3HuaDBk/bR/SDELGKRnMYrJhWuy8l882z+/c8Fjc38tWrAMcdgSlJLMQCoLu0 Mx2lwlO/8fPQkS+WHG3Uuv/Uur0ldw1Ws4MZVU2YsM6Cb0R03R5nunjsERZNckM7f2v0 yoVKpKijdarlDzgJmUNgKqj/u9khUMU6kTwVF6TsCVJ39EGOCie9uihO7B/MCQ/mCmnn Jtw8o2Fxq9E0vJbaqR4Ki1ZVtzrCW3wA4kSMpVs8wk8DKnZVzlN7kK5bfn54mEi/u+V7 IXAfPbtKaZZNBSp2pW2FOrdq/KERx1a6XKYjLqXWn7DDYdmY7zaX85JoRh2TjugrhmiZ 2QKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:mime-version:message-id:date :dkim-signature; bh=nz52NPo/ldRCO4SlmJCa/5s+fqete8nkApWr4O0tYXg=; fh=wFFPmy5oZx9gf1iTxJ8OPAx6+fLFvzTVx6T3ogPJNVM=; b=ziNJJLxDJp4rttlTGiMUu4hzfEV0d91YRP0pCguXLxOpz78z92qw7jRUd8J6YlB5sa OJUfFZpn/o4bZho/zQkFzwjS9j/GtsW3c6znBfWotsJQJcSA6JjlZUM4bSi/Gwyjkfcm D6VsrULF9Wkxj0P9IQxR+IwOFMD6QYXJ5LCx2Qp4h0aq6LKmWEXamtoc3ZzGTnUerfET VPmzPEMdNx15mIjGxGxIml+SuPVNLgqRNjvgpoaiZkCNa0Cqvl7Z5BstqKg1tawIZWnk 2UK3pMRBSvoHGuqt+TqpNv/7RWDCubL/hLwJ3yDFEmZ0fgTMaZl9zc9wMgTHmUrAOM+1 Cd6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=v0gr7cPW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id u11-20020a17090341cb00b001b9c3498510si6201054ple.469.2023.09.23.06.57.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 06:57:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=v0gr7cPW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 2243381829ED; Fri, 22 Sep 2023 22:35:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229660AbjIWFfq (ORCPT + 99 others); Sat, 23 Sep 2023 01:35:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229561AbjIWFfo (ORCPT ); Sat, 23 Sep 2023 01:35:44 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD9EE1A1 for ; Fri, 22 Sep 2023 22:35:37 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-59f4c72c66fso18106147b3.2 for ; Fri, 22 Sep 2023 22:35:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695447337; x=1696052137; darn=vger.kernel.org; h=to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=nz52NPo/ldRCO4SlmJCa/5s+fqete8nkApWr4O0tYXg=; b=v0gr7cPWUEjzrH4M9hCXYqtzyhLDUn1sNxRtXxDiaxOYA5gR/Sr45yji+/H2KK9bnC 4+K2JcPBOJ4VSa6yc2Vb+GxyKeVwd0N/LGZfJFoFCq8YArrcFm0XmvMPB2uf7zAWBYTb cX+QM/e7bKKSxztbBLDj3VVAGYkn7jCq2YBYY58wx4NLl7fiaNm9IaAaJpGz2Pe8ajBV +b4SDwiEBXaZ2EFzfKWzqpNhdK7QzsIDavFva7bRBXAtZXU5nnCejVv2646bNUmOxNYA WFfAkjQbdhmVNVZAtYymBUpO7T2YKP/qc14GUu1t+HAnVowxM88tilYYYOqnBtNNyu4O BJdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695447337; x=1696052137; h=to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=nz52NPo/ldRCO4SlmJCa/5s+fqete8nkApWr4O0tYXg=; b=BtTpoU5kSlw6Ddhr1Vn9EZizLTk2T0rqlm/z3zKG5cDUj/jEfQu1LaXFlGYqYsP4WI XhiRZ0MdAuVbcztMtR+RCfwTQQugVMh4Ex7m751Cr53+LMpZRpjKtew2u2fj/uV2sryW gk4isrldf2jrZuDBXCMTLzzRYobuPNQWyrP5p1Sv6Kj5ee3uP//uGciqYBai4dILBUED y+W4sdz+bfdryTg/pSe0lrJ4BO8aaHO6JmVkxRoC44wle5s1PIfUyiIF/ZjaGlWPmmgW 5pbI6lxK1NhrtWYvSQ6OrKa9JI6N2PTh778OjNRg5heGFcknLw/9ptZSw0OqAalWrBd4 S9fA== X-Gm-Message-State: AOJu0YxvY67RBwnCW8l+pTkrO/36SOmjmYFJagPHaGMj84GDYI71uYbT cVeMUXWi6Y/jcjjRNyTHyZDOoLcUBRSm X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:a376:2908:1c75:ff78]) (user=irogers job=sendgmr) by 2002:a81:4417:0:b0:59b:db15:a088 with SMTP id r23-20020a814417000000b0059bdb15a088mr21169ywa.3.1695447336863; Fri, 22 Sep 2023 22:35:36 -0700 (PDT) Date: Fri, 22 Sep 2023 22:34:57 -0700 Message-Id: <20230923053515.535607-1-irogers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.42.0.515.g380fc7ccd1-goog Subject: [PATCH v1 00/18] clang-tools support in tools From: Ian Rogers 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 , Paolo Bonzini , llvm@lists.linux.dev, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, bpf@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-4.8 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 22 Sep 2023 22:35:54 -0700 (PDT) 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. 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 | 34 ++++++++--- 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, 106 insertions(+), 57 deletions(-) -- 2.42.0.515.g380fc7ccd1-goog