From 7f5937df01cc829544baa921bfb81bfe0ccdc892 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 16 Jan 2023 17:24:16 -0700 Subject: [PATCH] Convert block_gdbarch to method This converts block_gdbarch to be a method. This was mostly written by script. --- gdb/ada-lang.c | 2 +- gdb/block.c | 8 ++++---- gdb/block.h | 8 ++++---- gdb/cp-namespace.c | 2 +- gdb/d-namespace.c | 2 +- gdb/symtab.c | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 0198598982c..a1de8c43bf2 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -13822,7 +13822,7 @@ public: if (block == NULL) gdbarch = target_gdbarch (); else - gdbarch = block_gdbarch (block); + gdbarch = block->gdbarch (); sym.symbol = language_lookup_primitive_type_as_symbol (this, gdbarch, name); if (sym.symbol != NULL) diff --git a/gdb/block.c b/gdb/block.c index d7d5f0bf19e..b9c48e79d46 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -54,12 +54,12 @@ block::objfile () const /* See block. */ struct gdbarch * -block_gdbarch (const struct block *block) +block::gdbarch () const { - if (block->function () != nullptr) - return block->function ()->arch (); + if (function () != nullptr) + return function ()->arch (); - return block->objfile ()->arch (); + return objfile ()->arch (); } /* See block.h. */ diff --git a/gdb/block.h b/gdb/block.h index 2243c9a2a52..b9f1ba81b50 100644 --- a/gdb/block.h +++ b/gdb/block.h @@ -208,6 +208,10 @@ struct block struct objfile *objfile () const; + /* Return the architecture of this block. */ + + struct gdbarch *gdbarch () const; + /* Addresses in the executable code that are in this block. */ CORE_ADDR m_start; @@ -335,10 +339,6 @@ private: struct block *m_blocks[1]; }; -/* Return the architecture of BLOCK, which must be non-NULL. */ - -extern struct gdbarch *block_gdbarch (const struct block *block); - extern struct symbol *block_linkage_function (const struct block *); extern struct symbol *block_containing_function (const struct block *); diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index b1c54c57da6..97b7a653e33 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -197,7 +197,7 @@ cp_lookup_bare_symbol (const struct language_defn *langdef, if (block == NULL) gdbarch = target_gdbarch (); else - gdbarch = block_gdbarch (block); + gdbarch = block->gdbarch (); sym.symbol = language_lookup_primitive_type_as_symbol (langdef, gdbarch, name); sym.block = NULL; diff --git a/gdb/d-namespace.c b/gdb/d-namespace.c index 2978e5fecaf..aaef1dfae1f 100644 --- a/gdb/d-namespace.c +++ b/gdb/d-namespace.c @@ -94,7 +94,7 @@ d_lookup_symbol (const struct language_defn *langdef, if (block == NULL) gdbarch = target_gdbarch (); else - gdbarch = block_gdbarch (block); + gdbarch = block->gdbarch (); sym.symbol = language_lookup_primitive_type_as_symbol (langdef, gdbarch, name); sym.block = NULL; diff --git a/gdb/symtab.c b/gdb/symtab.c index 408416890ac..7b7e52505ef 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -2442,7 +2442,7 @@ language_defn::lookup_symbol_nonlocal (const char *name, if (block == NULL) gdbarch = target_gdbarch (); else - gdbarch = block_gdbarch (block); + gdbarch = block->gdbarch (); result.symbol = language_lookup_primitive_type_as_symbol (this, gdbarch, name); result.block = NULL; -- 2.30.2