Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Simplify ada_parse_renaming
@ 2026-07-23 15:43 Tom Tromey
  2026-07-24 10:11 ` Andrew Burgess
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2026-07-23 15:43 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-24 10:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-23 15:43 [PATCH] Simplify ada_parse_renaming Tom Tromey
2026-07-24 10:11 ` Andrew Burgess

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox