Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp250289rdh; Sat, 23 Sep 2023 08:48:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHT2KFP1VaJirxCO4iVOjy5ZYTBU4pgQQo9d+znr0e8x7+QNPUlN3rgOJp+u3n+Utg/KZi4 X-Received: by 2002:a05:6808:1804:b0:3a7:92af:878d with SMTP id bh4-20020a056808180400b003a792af878dmr4119248oib.53.1695484123018; Sat, 23 Sep 2023 08:48:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695484122; cv=none; d=google.com; s=arc-20160816; b=eunIDubFPeZ7xa4ihmmqyiZNahTKo6sTmuvpOpIkmNW3wC581HymK1uz6owWeL/V7E IQa3SU00EdXC9zic9vTaT9mBbglhveSCVPU2MUxnXhEmdcYP7zb9gL1KJv0TMXLPJwiM ujSHLSm5iFpIyZbzJlnRNWrhbqLybcVnoA3D6m1wszRbI+cVLHaje/xzcDozR2XWWjkp ctlyJsQRJxypKXBv5pokIh4jHF5UOSs9TWf2ouubCgALexgAxFuXSsvu4XFdnvHzN+pI kgQIqVG1pU9uPigtV07ce5DajVylxw2oIzCYjf0rvi9VuxtHOLIuiK5U4aDMSZWAKKZi AkHQ== 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=BGf8PiM0IiriMve24vBUlDxd/ZI4TAjoSgcit1w5zEk=; fh=wFFPmy5oZx9gf1iTxJ8OPAx6+fLFvzTVx6T3ogPJNVM=; b=bGkC37GLnbfrS3jSIbCpLsfmQaJikpaczCdX6JNrVqedUdceBCFbB4fB9mPwqAMl82 XvYQpweTPKCD3TKNvDZ2GLcA4nxQxfeb6qjUvRWCm7Nox4bDeCvvUsJ/1EgEyIX4tBG1 3Rvnl3O1sZKQEUQcK22X+cr3U1iqMnLclmDvuP0digCwHndOmW2DnqG9eUvSF26y1bow S4JPKh3csJJTHQ1U80o/axwSctbWzpiYMlb6myXUJ9JkMEcjjrp0tkpuJKxV8Wg7u4QZ 6wLDg+1mV+QqEQH43mFtj4Wgj/6AohGVxp91muq74k58mWpa1iHX4EpplGY9UJhiLnnu 4Bqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=iC5lHGL7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id t38-20020a056a0013a600b0068fe810e870si6721912pfg.100.2023.09.23.08.48.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 08:48:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=iC5lHGL7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 355DF801F35E; Fri, 22 Sep 2023 22:36:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229808AbjIWFft (ORCPT + 99 others); Sat, 23 Sep 2023 01:35:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229608AbjIWFfq (ORCPT ); Sat, 23 Sep 2023 01:35:46 -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 D4AB61A7 for ; Fri, 22 Sep 2023 22:35:39 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-59e79a36097so105018267b3.0 for ; Fri, 22 Sep 2023 22:35:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695447339; x=1696052139; 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=BGf8PiM0IiriMve24vBUlDxd/ZI4TAjoSgcit1w5zEk=; b=iC5lHGL7HASQPtSViakLGECJ4XhRQ8ewcJaAbS5zKRzlCABO3fqmMS3x7ZIWdcDVuF o2T23ncMGmaBR5wfmmKYVRTqXtHaf9+6MUjKaNsleoNR+DFXfizmkxys1fvdWRcpbk0t H6V8ku8IToq0tsZ39jqCQxxeCSujJu8sLaE3Q18Xk7CcBA6HaczAJzu+1w7ub0b9iBZN MMUsh2NhoAUdP+p9HWq6o9ugYpYG/Gw1ZwtUHZavk6/e+DJpVTVz38ctELel2uYjrq12 nhBkehEL+B8Vy8uA7HDaa8NAkHi6pZmxI9cE0IZxUOOqK2JtrvXOGw0BCFFNyebZee80 W2yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695447339; x=1696052139; 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=BGf8PiM0IiriMve24vBUlDxd/ZI4TAjoSgcit1w5zEk=; b=fZP9xtZI5BQMXLn1XnKIr0AfGNy+U+tQgyAIaF6lwA35YK3PFZoP2BucjZeM763WrH YPqUIDbDHP77+PlcoQHdOr5aDPe2z/dsb7tHi+tNZ4cwl3cLV95AWH+Qkau/19qK7JL4 k3TficUdZ/zGYOxJmYx0ALAhZKJ5fqWtVjiT+9Kx8zxIcaGd73xphbAEjJNU7mcaxaCW LjTe7AukWKYEudb+5GPrTKs4i2mQY4FLV8oo8GI6IQp4abRlEvEjfOqvS4UTKIfN+VKr 4MNqf4yNsv/A42UBZ/w4ycOvpq0Ulw3xTfpk2KlaNaG/prn8l4pO8suGH2on3tcHVxQv nCpA== X-Gm-Message-State: AOJu0YziocMq1cLMxebiJGcM/5yaX4xB/OGci3Tco2YVa5dCYtK3Dylz lEftCnTU7FkSZ+Jkxi1LbsH268bOZeRX X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:a376:2908:1c75:ff78]) (user=irogers job=sendgmr) by 2002:a05:690c:707:b0:59f:4c14:ac5e with SMTP id bs7-20020a05690c070700b0059f4c14ac5emr28292ywb.2.1695447338979; Fri, 22 Sep 2023 22:35:38 -0700 (PDT) Date: Fri, 22 Sep 2023 22:34:58 -0700 In-Reply-To: <20230923053515.535607-1-irogers@google.com> Message-Id: <20230923053515.535607-2-irogers@google.com> Mime-Version: 1.0 References: <20230923053515.535607-1-irogers@google.com> X-Mailer: git-send-email 2.42.0.515.g380fc7ccd1-goog Subject: [PATCH v1 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 , 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 morse.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 (morse.vger.email [0.0.0.0]); Fri, 22 Sep 2023 22:36:27 -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 --- 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.515.g380fc7ccd1-goog