mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-16 04:18:50 +00:00
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.
This commit is contained in:
18
gdb/block.c
18
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 ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user