diff options
author | Tom Tromey <tom@tromey.com> | 2023-01-16 18:14:47 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2023-02-19 12:51:06 -0700 |
commit | d24e14a0c62181b49f513f6ed3704212fd276c79 (patch) | |
tree | 341cbf16737b778d0a4cb71276adfe209cf4bb6c /gdb/block.c | |
parent | 99f3dfd0f94144d295885e79f4ff5a5f8119fb04 (diff) | |
download | gdb-d24e14a0c62181b49f513f6ed3704212fd276c79.zip gdb-d24e14a0c62181b49f513f6ed3704212fd276c79.tar.gz gdb-d24e14a0c62181b49f513f6ed3704212fd276c79.tar.bz2 |
Convert block_static_block and block_global_block to methods
This converts block_static_block and block_global_block to be methods.
This was mostly written by script. It was simpler to convert them at
the same time because they're often used near each other.
Diffstat (limited to 'gdb/block.c')
-rw-r--r-- | gdb/block.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/gdb/block.c b/gdb/block.c index 31916ce..c0d6ed7 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -47,7 +47,7 @@ block::objfile () const if (function () != nullptr) return function ()->objfile (); - global_block = (struct global_block *) block_global_block (this); + global_block = (struct global_block *) this->global_block (); return global_block->compunit_symtab->objfile (); } @@ -349,26 +349,28 @@ block::set_using (struct using_direct *using_decl, struct obstack *obstack) m_namespace_info->using_decl = using_decl; } -/* Return the static block associated to BLOCK. Return NULL if block - is a global block. */ +/* See block.h. */ const struct block * -block_static_block (const struct block *block) +block::static_block () const { - if (block->superblock () == NULL) - return NULL; + if (superblock () == nullptr) + return nullptr; + const block *block = this; while (block->superblock ()->superblock () != NULL) block = block->superblock (); return block; } -/* Return the static block associated to BLOCK. */ +/* See block.h. */ const struct block * -block_global_block (const struct block *block) +block::global_block () const { + const block *block = this; + while (block->superblock () != NULL) block = block->superblock (); |