Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH] Simplify ada_parse_renaming
Date: Thu, 23 Jul 2026 09:43:06 -0600	[thread overview]
Message-ID: <20260723154306.3708516-1-tromey@adacore.com> (raw)

While working on gnat-llvm, I found that ada_parse_renaming checks the
"loc_class" of the symbol.  This caused a problem with my WIP
gnat-llvm patch, which emitted a renaming symbol as LOC_CONST.

I've since fixed my gnat-llvm patch; but nevertheless it seems to me
that there's no need to check this.  In Ada, no user-provided symbol
will have an "___XR" substring, as such symbols are all lower-cased.

This patch removes the check, simplifying ada_parse_renaming.
---
 gdb/ada-lang.c | 50 ++++++++++++++++++++------------------------------
 1 file changed, 20 insertions(+), 30 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index a7019a4522c..d948c68a012 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -4400,43 +4400,33 @@ ada_parse_renaming (struct symbol *sym,
 		    const char **renaming_expr)
 {
   enum ada_renaming_category kind;
-  const char *info;
   const char *suffix;
 
   if (sym == NULL)
     return ADA_NOT_RENAMING;
-  switch (sym->loc_class ())
+  const char *info = strstr (sym->linkage_name (), "___XR");
+  if (info == nullptr)
+    return ADA_NOT_RENAMING;
+  switch (info[5])
     {
+    case '_':
+      kind = ADA_OBJECT_RENAMING;
+      info += 6;
+      break;
+    case 'E':
+      kind = ADA_EXCEPTION_RENAMING;
+      info += 7;
+      break;
+    case 'P':
+      kind = ADA_PACKAGE_RENAMING;
+      info += 7;
+      break;
+    case 'S':
+      kind = ADA_SUBPROGRAM_RENAMING;
+      info += 7;
+      break;
     default:
       return ADA_NOT_RENAMING;
-    case LOC_LOCAL:
-    case LOC_STATIC:
-    case LOC_COMPUTED:
-    case LOC_OPTIMIZED_OUT:
-      info = strstr (sym->linkage_name (), "___XR");
-      if (info == NULL)
-	return ADA_NOT_RENAMING;
-      switch (info[5])
-	{
-	case '_':
-	  kind = ADA_OBJECT_RENAMING;
-	  info += 6;
-	  break;
-	case 'E':
-	  kind = ADA_EXCEPTION_RENAMING;
-	  info += 7;
-	  break;
-	case 'P':
-	  kind = ADA_PACKAGE_RENAMING;
-	  info += 7;
-	  break;
-	case 'S':
-	  kind = ADA_SUBPROGRAM_RENAMING;
-	  info += 7;
-	  break;
-	default:
-	  return ADA_NOT_RENAMING;
-	}
     }
 
   if (renamed_entity != NULL)

base-commit: 39fc0cc4aa6f82a73b9eac6b8739895484ab269f
-- 
2.55.0


             reply	other threads:[~2026-07-23 15:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23 15:43 Tom Tromey [this message]
2026-07-24 10:11 ` Andrew Burgess

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=20260723154306.3708516-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