Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2076608rdb; Mon, 9 Oct 2023 11:40:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFpqiACpsfdka3Fkq1Ielkdvt/scTBIVvZVncyiQwqwGCUy9H04yDv+XUCyZAAGN2ij35RE X-Received: by 2002:a05:6a00:23c8:b0:68e:265d:c2b5 with SMTP id g8-20020a056a0023c800b0068e265dc2b5mr19613172pfc.29.1696876800098; Mon, 09 Oct 2023 11:40:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696876800; cv=none; d=google.com; s=arc-20160816; b=h63YlFvO1EHUFaSk1j8W3gfp+fijJpPPRoYKW3mm05nLFiR5S2R7pe9ACw8WozDDC0 3lFQfaQVYM2jbjQvC79t42OP6u0xaA4jxRu7r14lsGFPbpF6FV7JXSO0Clz1o8g7bV/4 2qvfxeQPrr9GezXYwZQpviih5nAYgH4fGJhaewumlt438Qpe2VXSkMhjo0AmgSzvhVAh RY45vOIOGSk2stQOAFNSv1JcyFNDW6WcQy9ZditO9s198x2LTKnoJ2Tero1ne/Df6Aog f2ngiqbL3BgSbUKaLFItQgcugmk2hF6P4Nj90RJbFCmehZV5fM+3exSDKtu1IEVh/JOS TUyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=mqO+Ua8t6nlwvlcHvKwWAEoEKjeWve4b13tLAZbDaS4=; fh=8uoRd8OfBKdrcgzCS0TCbKG83gg6rx5b6zeE6Tx82zI=; b=igxcYWAvlwdkhLWI6mAdVR/yeS0ujgSzBIP7DIGFNqL4blZhV2t0cSEmYkB5570i+/ lbTeC6yxDXUbcpacHk+g7okLYuwARjpWHmmyjgPKDR6kh3OcE52cmKgNcZIf/7geE2sQ EbmmD4U04VeUSEvYpYMVEZHpYjuVYgFIXsJq9KSvbHwj36niSYto/Al9iMu3dQJsGCOC 2LJst/vJsjdVHNMOnDXWHao0HkkqHWggqjfCSMcN+VE/+1k2dr4hGi4I6aM7USntB3WQ F0rMMFpC+LX/1sRf2M8yf9WDOUE//kHveLnRGeI8jCbxkoCuXOTmYj/kTmr1of+Y3P1Q NIuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=TKxbdCDk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id cq24-20020a056a00331800b0068fba70d25dsi7737122pfb.33.2023.10.09.11.39.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 11:40:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=TKxbdCDk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id E9CC380BA7FD; Mon, 9 Oct 2023 11:39:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378219AbjJISje (ORCPT + 99 others); Mon, 9 Oct 2023 14:39:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378156AbjJISjb (ORCPT ); Mon, 9 Oct 2023 14:39:31 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6500CA6 for ; Mon, 9 Oct 2023 11:39:29 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5a213b4d0efso73084397b3.2 for ; Mon, 09 Oct 2023 11:39:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696876768; x=1697481568; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=mqO+Ua8t6nlwvlcHvKwWAEoEKjeWve4b13tLAZbDaS4=; b=TKxbdCDkBWdYhlDTIxIVylHp7xWFWu79iK2O8lraz+QDiWTJx6k3QpxaoGQYe5R260 tpPX5YRHBNoLzTx9lxfzsvzwUgnUixUpG3YF2qJEh+f3W+upCMFj39WhJ1RFlhbqOdIE zv46yB5jOSK/FWrAIP0xI7qMdCrB4ZSVoT3nbBaOpLMAcdrtSdT0jL0loH98XA0aLhZr dtufYrU14jAAPjxsrLyBTcCiXb+YzC2NCauiChbTmXQrsb85qRMCpph6A2PcgVAraVVn OrxbsQEQRXqHNBTfBJUgL0GTbYGBPSVPi2Y7YtJmK7ZJ5MvFYRP3/q1E6AFfrfXkTO8Y 00wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696876768; x=1697481568; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mqO+Ua8t6nlwvlcHvKwWAEoEKjeWve4b13tLAZbDaS4=; b=CJXsUOPMLnOwtmbcZumSd3+MFSLggWxP5PrCQWfw7Ms0ejtXqra6KvOkm27JgMBSRE PLPbmD2T0Y44v1HTnjMWBR5g6cmGxQIta31CvONbxsNlTbD/5SyPBC/Nv66WGX9NxUdu Oovbk3wsuhMJkI+trnce0ArBoZJj4z+JlaGG6B415uJS4GEoc/EzZfIKRWfUVL6Zkpih StH9crgXmllcPMKyD747J2tKWG7Gocsc4lGUvVFz+kHfnFrzZlIUr2BIcoQ/QAnP8Pst u5OaGapEjGtT1d0GS35i/MWffbihtFuuy5fXPzcDDIHLWL7GYqPacXr6n26+Dt3LY8Kh RO/w== X-Gm-Message-State: AOJu0YxY6xcKR5OQsJIRtLdcGiBr4s+rxxgPV5tiNnd0uO3vxYdv/xHM kqCwrw3WXuLHeAXweQmq/3B5sLpF/mFz X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:ac4a:9b94:7158:3f4e]) (user=irogers job=sendgmr) by 2002:a81:bc03:0:b0:59b:c6bb:babb with SMTP id a3-20020a81bc03000000b0059bc6bbbabbmr297622ywi.6.1696876768652; Mon, 09 Oct 2023 11:39:28 -0700 (PDT) Date: Mon, 9 Oct 2023 11:39:02 -0700 In-Reply-To: <20231009183920.200859-1-irogers@google.com> Message-Id: <20231009183920.200859-2-irogers@google.com> Mime-Version: 1.0 References: <20231009183920.200859-1-irogers@google.com> X-Mailer: git-send-email 2.42.0.609.gbb76f46606-goog Subject: [PATCH v3 01/18] gen_compile_commands: Allow the line prefix to still be cmd_ 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 , Yang Jihong , Huacai Chen , Ming Wang , Kan Liang , Ravi Bangoria , 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 groat.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 (groat.vger.email [0.0.0.0]); Mon, 09 Oct 2023 11:39:49 -0700 (PDT) Builds in tools still use the cmd_ prefix in .cmd files, so don't require the saved part. Name the groups in the line pattern match so that changing the regular expression is more robust and works with the addition of a new match group. Signed-off-by: Ian Rogers Reviewed-by: Nick Desaulniers --- scripts/clang-tools/gen_compile_commands.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/clang-tools/gen_compile_commands.py b/scripts/clang-tools/gen_compile_commands.py index a84cc5737c2c..b43f9149893c 100755 --- a/scripts/clang-tools/gen_compile_commands.py +++ b/scripts/clang-tools/gen_compile_commands.py @@ -19,7 +19,7 @@ _DEFAULT_OUTPUT = 'compile_commands.json' _DEFAULT_LOG_LEVEL = 'WARNING' _FILENAME_PATTERN = r'^\..*\.cmd$' -_LINE_PATTERN = r'^savedcmd_[^ ]*\.o := (.* )([^ ]*\.[cS]) *(;|$)' +_LINE_PATTERN = r'^(saved)?cmd_[^ ]*\.o := (?P.* )(?P[^ ]*\.[cS]) *(;|$)' _VALID_LOG_LEVELS = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] # The tools/ directory adopts a different build system, and produces .cmd # files in a different format. Do not support it. @@ -213,8 +213,8 @@ def main(): result = line_matcher.match(f.readline()) if result: try: - entry = process_line(directory, result.group(1), - result.group(2)) + entry = process_line(directory, result.group('command_prefix'), + result.group('file_path')) compile_commands.append(entry) except ValueError as err: logging.info('Could not add line from %s: %s', -- 2.42.0.609.gbb76f46606-goog