public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH] Move allocate_stub_method to stabsread.c
Date: Fri, 24 Feb 2023 13:56:03 -0700	[thread overview]
Message-ID: <20230224205603.2765694-1-tromey@adacore.com> (raw)

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)
 }
 \f
 
+/* 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
-- 
2.39.1


             reply	other threads:[~2023-02-24 20:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24 20:56 Tom Tromey [this message]
2023-03-10 14:57 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230224205603.2765694-1-tromey@adacore.com \
    --to=tromey@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).