From patchwork Thu May 25 12:20:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?6IOh546u5paH?= X-Patchwork-Id: 13255149 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8D31C77B7E for ; Thu, 25 May 2023 12:21:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240576AbjEYMVA (ORCPT ); Thu, 25 May 2023 08:21:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233263AbjEYMU7 (ORCPT ); Thu, 25 May 2023 08:20:59 -0400 Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01olkn2028.outbound.protection.outlook.com [40.92.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5382A189 for ; Thu, 25 May 2023 05:20:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iSApx17VEnMN8WktLkvaeYNHhs9XeFpl5S6VT+zp+J3ujgcwwPzFs6tDhMGiFMZA3ySMr5W5BmiQl6qQZUz2GIGLe16sK9ojv2wVdMelgJNtHONo/FuUbVYGtINz0AKLCb+K0e/y8nfhfHxx84iy9zEnX9gKY9b0fdw2Cjzl8VAilYzY7mMlD5I8uExD1+nAo/F9ynuYfmz/V5zdyMOxEv3OVJn7oADO2FEJ1cpjqa9MWD4LqbCCjch0SG1m7D49MGKfkQdiV8dHiCPsqIqLduPWrR3kbAJWjNFza9tEYWElMSOqvOmusy/RcUIvMOnbMaRnlwxoYPtwTOmnL8F5+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/wsU6m0yN1jTFw+hjGvbzCnmpRoiOqwSTmL1J5o1OTM=; b=mITcoUM4AN5N8xVnqVt/6ES1JkZdLA5xJr9mCN/4LkD9+KitF5haGWbUML98+Beovip8g4IjhNqHjdGOGjq24grS1uihQn9lei+rJJHclv9vuaPpdk8Ne9Y31w0Wx21qX8oQmsNGN2ORwPS1Bt96RQHSSbydt2XLdKGGyb8hsKETZtjJkAEygpLmlxUGPXf93467iNYtbVR8/MIez+Tvm7lYsgcBObm9Plr4zthgUfPmgWKygkv28qiL27ooQ6T/h2F7CbVLrU2Ss1qnWyPA6A80R88NKd7dE0YzuIYxvK6YWjYp+47vRatFwoZTiPDdbvuF/Sb7WL0DfsTzZLEC6A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/wsU6m0yN1jTFw+hjGvbzCnmpRoiOqwSTmL1J5o1OTM=; b=gMjAidOzbfLrsDct30IcpzHKulFv4cmh4mTW/KqD2dCyjVZbTtRN0wjeBmMBSiNA4ao63KaoE1cHNBT/ac8EGdr9PyAGHHjSZxqvVfkoqEfMxBLm6jzPBrQesxORB9ukpr8Ud+XCJVS2YtXxd+aD7F4KBWKZdrkkrFcAYJZsZs3Uim57e/oxWSniyr9o/hYil6oUalgiNwV98XwbgZUN3aP6qsf8DPnirLl8qds2BRfdlsR006MrevQ6m5+EXJ49hqBMmoCaF1dQDD4ouHqRze+Ikyj7o38rlbuqVl1ZCL6YHDklWkV4sBhivnuyFfcVUJxLCTui7l8G/NotMA6j/g== Received: from OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:180::6) by TYCP286MB1610.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:183::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.16; Thu, 25 May 2023 12:20:55 +0000 Received: from OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM ([fe80::b4f8:4693:7f59:55db]) by OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM ([fe80::b4f8:4693:7f59:55db%7]) with mapi id 15.20.6411.029; Thu, 25 May 2023 12:20:55 +0000 From: Hu Weiwen To: Nick Desaulniers Cc: llvm@lists.linux.dev, Nathan Chancellor , Tom Rix , Linux Kbuild mailing list , Masahiro Yamada , Hu Weiwen Subject: [PATCH v2] gen_compile_commands: include targets not ending with .o Date: Thu, 25 May 2023 20:20:03 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [w0NVy0w2gu9+A8sK+wqyel0nBL6+ENQx] X-ClientProxiedBy: SGBP274CA0006.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b0::18) To OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:180::6) X-Microsoft-Original-Message-ID: <20230525122003.6122-1-huww98@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OSZP286MB2061:EE_|TYCP286MB1610:EE_ X-MS-Office365-Filtering-Correlation-Id: 37a29ca4-8414-4885-3576-08db5d1a7c89 X-MS-Exchange-SLBlob-MailProps: EgT5Wr3QDKxl1qg+92OPC7eRkgV6gGlHRrh7VZQj1DzV78yrdurG5XpLSmMtEyPyfsN1Rr47Neo+jjovJPtnJKK6GvkQoYqd17H4W3vIJyyLdwxLK9vYB9xygPZJETF7VsxIDl5ViP8vmLiH6MRNQVo9hYeeJYnmB1iLtp31Wi8/DFkV6H8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ytnK/+pGvOWtmO4CUZhQBIw4YIweDh42Jmk2RnaQ9B/uGNP3uOSvlbBlSXhKSyJuhEFGahBCqgxLRuq+AzS5VeZ/OFQbwkkhuX9OmdJh2/kh9FlEXO96hyC+PJi6nqNYUL9p0oLaf6lsEEY0U8jFdvQCuKeA++Ijxu6umhzl3maZOxsJk1zZgd1yVVg8imz/NZCmE7njN7Agt2ksVjSB2qU4ByRyjEav6VVKUtlffYMxdrwJPyiHkg7lVDYLFI8YdLfaNWQ0Z1f3ZcWgapHRS0aLTYkH+H2LgcaFd11Bce16fetWb9BCAy1oJBf3DhqxN2ab0MFhq+auB7Ot6ZOv8rPyCPZx1rrcHJ8v4VYfD5cEc3HZ/gWOoYGGP8A== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 37a29ca4-8414-4885-3576-08db5d1a7c89 X-MS-Exchange-CrossTenant-AuthSource: OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2023 12:20:55.1572 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCP286MB1610 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Currently, we only extract commands for targets ending with '.o'. But we also have many standalone executables built in-tree. Remove this restriction. And to avoid some false matching, exclude targets end with '.c' or '.h' when directly walking the directory. To really generate compile_commands.json that includes such target, call this script directly with no arguments. `make compile_commands.json` will not include them. Signed-off-by: Hu Weiwen --- Since V1: Only commit message is updated. scripts/clang-tools/gen_compile_commands.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/clang-tools/gen_compile_commands.py b/scripts/clang-tools/gen_compile_commands.py index 15ba56527acd..6e88c7e166fc 100755 --- a/scripts/clang-tools/gen_compile_commands.py +++ b/scripts/clang-tools/gen_compile_commands.py @@ -18,8 +18,8 @@ import sys _DEFAULT_OUTPUT = 'compile_commands.json' _DEFAULT_LOG_LEVEL = 'WARNING' -_FILENAME_PATTERN = r'^\..*\.cmd$' -_LINE_PATTERN = r'^savedcmd_[^ ]*\.o := (.* )([^ ]*\.c) *(;|$)' +_FILENAME_PATTERN = r'^\..*(?