From patchwork Fri Feb 24 20:56:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 65626 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 350833854803 for ; Fri, 24 Feb 2023 20:56:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 350833854803 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677272201; bh=1fJYJRKEw6OXpjpKEmztIxsBvW140+E0mhWaLu+5b0o=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=dc4BAO0u6DCLIjH7jEpWKuILcRn6NSfpt54d1znGmBNs65UrlnbA412T4ujkOy2FR c2lWnG9550/i7qFP1DBq19zEB0CVSObgNfFWAO1Afn4rXNb5ERyQUxaoAMnjguTwfh uc0ZxolyvMMcbuQolTyjLYzbS1jt7uZCoA5AUo28= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by sourceware.org (Postfix) with ESMTPS id 6955E3857C45 for ; Fri, 24 Feb 2023 20:56:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6955E3857C45 Received: by mail-il1-x135.google.com with SMTP id 4so512877ilz.6 for ; Fri, 24 Feb 2023 12:56:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1fJYJRKEw6OXpjpKEmztIxsBvW140+E0mhWaLu+5b0o=; b=acHpTg2CxmY5zH8I/dQjlQIVddbnQxj3p0K3PhJKzpMok9599dQ5kXUzrmU91iI7lI 8541fYWC8+auRO+9N6Ik7OGn9I+ERKfi/pv1yGF5yNfYBuTen0OHwMFPk9dI973A0m5g i+a4K70FM98YYPPDeaji4EM95ogFAPa1M8REfLSMzgH9uyv+n0HojBeh6UV0dldtOi7+ enUZ7gyctvtfN598Zko+oDVO/KqgHfJaeItx8mWgaZDasJcoAMjAdoIJCIlz0X4COJRV 0HQWR9q7AVilAksaoknGyiplrZC8C/vzrRj3C9mhimEMmVL5RqRu/jRi7B59W1UqNFCL i72w== X-Gm-Message-State: AO0yUKWBiKVq1GIsm9XGkCxU3Kxpko3Ol3mLHW0I/zITNoYWHucDq9Xc OJaAmfgNYORqctSrA0FlaaavtPYBOIjOIC4U X-Google-Smtp-Source: AK7set9rnyK3BCqamH69ouk3paxFyWWWi3c4oBGGeKZ/pDd53TJmm6Sj6SEHTFCT8uRy3p/Zxlnang== X-Received: by 2002:a05:6e02:b42:b0:314:110d:ab69 with SMTP id f2-20020a056e020b4200b00314110dab69mr14009172ilu.6.1677272173629; Fri, 24 Feb 2023 12:56:13 -0800 (PST) Received: from localhost.localdomain (75-166-130-93.hlrn.qwest.net. [75.166.130.93]) by smtp.gmail.com with ESMTPSA id i6-20020a02ca06000000b003b375247f89sm4828607jak.177.2023.02.24.12.56.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Feb 2023 12:56:12 -0800 (PST) To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Move allocate_stub_method to stabsread.c Date: Fri, 24 Feb 2023 13:56:03 -0700 Message-Id: <20230224205603.2765694-1-tromey@adacore.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom Tromey via Gdb-patches From: Tom Tromey Reply-To: Tom Tromey Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" allocate_stub_method is only called from stabsread.c, and I don't think it will be needed anywhere else. So, move it and make it static. Tested by rebuilding. --- gdb/gdbtypes.c | 20 -------------------- gdb/gdbtypes.h | 2 -- gdb/stabsread.c | 20 ++++++++++++++++++++ 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index f22ba44a538..32d195e27c4 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -861,26 +861,6 @@ lookup_methodptr_type (struct type *to_type) return mtype; } -/* Allocate a stub method whose return type is TYPE. This apparently - happens for speed of symbol reading, since parsing out the - arguments to the method is cpu-intensive, the way we are doing it. - So, we will fill in arguments later. This always returns a fresh - type. */ - -struct type * -allocate_stub_method (struct type *type) -{ - struct type *mtype; - - mtype = alloc_type_copy (type); - mtype->set_code (TYPE_CODE_METHOD); - mtype->set_length (1); - mtype->set_is_stub (true); - mtype->set_target_type (type); - /* TYPE_SELF_TYPE (mtype) = unknown yet */ - return mtype; -} - /* See gdbtypes.h. */ bool diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index c2253310666..ce78f05fbc8 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -2311,8 +2311,6 @@ extern void smash_to_memberptr_type (struct type *, struct type *, extern void smash_to_methodptr_type (struct type *, struct type *); -extern struct type *allocate_stub_method (struct type *); - extern const char *type_name_or_error (struct type *type); struct struct_elt diff --git a/gdb/stabsread.c b/gdb/stabsread.c index ca9132b37d0..39bb3f32a73 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -1464,6 +1464,26 @@ error_type (const char **pp, struct objfile *objfile) } +/* Allocate a stub method whose return type is TYPE. This apparently + happens for speed of symbol reading, since parsing out the + arguments to the method is cpu-intensive, the way we are doing it. + So, we will fill in arguments later. This always returns a fresh + type. */ + +static struct type * +allocate_stub_method (struct type *type) +{ + struct type *mtype; + + mtype = alloc_type_copy (type); + mtype->set_code (TYPE_CODE_METHOD); + mtype->set_length (1); + mtype->set_is_stub (true); + mtype->set_target_type (type); + /* TYPE_SELF_TYPE (mtype) = unknown yet */ + return mtype; +} + /* Read type information or a type definition; return the type. Even though this routine accepts either type information or a type definition, the distinction is relevant--some parts of stabsread.c