[binutils-gdb] Change type_stack::insert to take gdbarch

Tom Tromey tromey@sourceware.org
Wed Sep 10 00:26:16 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6038b1125839ee73393bce19339689824f8cf3f1

commit 6038b1125839ee73393bce19339689824f8cf3f1
Author: Tom Tromey <tom@tromey.com>
Date:   Sat Aug 23 11:51:03 2025 -0600

    Change type_stack::insert to take gdbarch
    
    This changes type_stack::insert to take a gdbarch rather than an
    expr_builder.  This is simpler and means that type_stack doesn't have
    to know anything about expression building; the parser-defs.h include
    can be removed.
    
    Approved-By: Simon Marchi <simon.marchi@efficios.com>

Diff:
---
 gdb/c-exp.y      | 4 ++--
 gdb/type-stack.c | 6 ++----
 gdb/type-stack.h | 2 +-
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 3abfafe4b52..11f0d88bfc0 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -1248,12 +1248,12 @@ single_qualifier:
 			{ cpstate->type_stack.insert (tp_restrict); }
 	|	'@' NAME
 		{
-		  cpstate->type_stack.insert (pstate,
+		  cpstate->type_stack.insert (pstate->gdbarch (),
 					      copy_name ($2.stoken).c_str ());
 		}
 	|	'@' UNKNOWN_CPP_NAME
 		{
-		  cpstate->type_stack.insert (pstate,
+		  cpstate->type_stack.insert (pstate->gdbarch (),
 					      copy_name ($2.stoken).c_str ());
 		}
 	;
diff --git a/gdb/type-stack.c b/gdb/type-stack.c
index fc12e5ed3a1..b9266b83f29 100644
--- a/gdb/type-stack.c
+++ b/gdb/type-stack.c
@@ -20,7 +20,6 @@
 #include "type-stack.h"
 
 #include "gdbtypes.h"
-#include "parser-defs.h"
 
 /* See type-stack.h.  */
 
@@ -51,7 +50,7 @@ type_stack::insert (enum type_pieces tp)
 /* See type-stack.h.  */
 
 void
-type_stack::insert (struct expr_builder *pstate, const char *string)
+type_stack::insert (struct gdbarch *gdbarch, const char *string)
 {
   union type_stack_elt element;
   int slot;
@@ -67,8 +66,7 @@ type_stack::insert (struct expr_builder *pstate, const char *string)
   element.piece = tp_space_identifier;
   insert_into (slot, element);
   element.int_val
-    = address_space_name_to_type_instance_flags (pstate->gdbarch (),
-						 string);
+    = address_space_name_to_type_instance_flags (gdbarch, string);
   insert_into (slot, element);
 }
 
diff --git a/gdb/type-stack.h b/gdb/type-stack.h
index f94e5262fb4..eeb2f358bde 100644
--- a/gdb/type-stack.h
+++ b/gdb/type-stack.h
@@ -212,7 +212,7 @@ public:
      stack is a tp_pointer, and the new values are inserted above the
      first item.  */
 
-  void insert (struct expr_builder *pstate, const char *string);
+  void insert (struct gdbarch *gdbarch, const char *string);
 
   /* Append the elements of the type stack FROM to the type stack
      THIS.  Always returns THIS.  */


More information about the Gdb-cvs mailing list