Use bool in buildsym

This changes the buildsym code to use bool rather than int, where
appropriate.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
Tom Tromey
2025-10-16 19:23:21 -06:00
parent a0afd6b66e
commit 3ca90840df
3 changed files with 21 additions and 19 deletions

View File

@@ -195,7 +195,7 @@ buildsym_compunit::finish_block_internal
struct pending_block *old_blocks,
const struct dynamic_prop *static_link,
CORE_ADDR start, CORE_ADDR end,
int is_global, int expandable)
bool is_global, bool expandable)
{
struct gdbarch *gdbarch = m_objfile->arch ();
struct pending *next, *next1;
@@ -381,7 +381,8 @@ buildsym_compunit::finish_block (struct symbol *symbol,
CORE_ADDR start, CORE_ADDR end)
{
return finish_block_internal (symbol, &m_local_symbols,
old_blocks, static_link, start, end, 0, 0);
old_blocks, static_link, start, end, false,
false);
}
/* Record that the range of addresses from START to END_INCLUSIVE
@@ -739,16 +740,16 @@ buildsym_compunit::watch_main_source_file_lossage ()
END_ADDR is the same as for end_compunit_symtab: the address of the end of
the file's text.
If EXPANDABLE is non-zero the STATIC_BLOCK dictionary is made
If EXPANDABLE is true the STATIC_BLOCK dictionary is made
expandable.
If REQUIRED is non-zero, then a symtab is created even if it does
If REQUIRED is true, then a symtab is created even if it does
not contain any symbols. */
struct block *
buildsym_compunit::end_compunit_symtab_get_static_block (CORE_ADDR end_addr,
int expandable,
int required)
bool expandable,
bool required)
{
/* Finish the lexical context of the last function in the file; pop
the context stack. */
@@ -814,19 +815,19 @@ buildsym_compunit::end_compunit_symtab_get_static_block (CORE_ADDR end_addr,
/* Define the STATIC_BLOCK. */
return finish_block_internal (NULL, get_file_symbols (), NULL, NULL,
m_last_source_start_addr,
end_addr, 0, expandable);
end_addr, false, expandable);
}
}
/* Implementation of the second part of end_compunit_symtab. Pass STATIC_BLOCK
as value returned by end_compunit_symtab_get_static_block.
If EXPANDABLE is non-zero the GLOBAL_BLOCK dictionary is made
If EXPANDABLE is true the GLOBAL_BLOCK dictionary is made
expandable. */
struct compunit_symtab *
buildsym_compunit::end_compunit_symtab_from_static_block
(struct block *static_block, int expandable)
(struct block *static_block, bool expandable)
{
struct compunit_symtab *cu = m_compunit_symtab;
std::unique_ptr<blockvector> blockvector;
@@ -854,7 +855,7 @@ buildsym_compunit::end_compunit_symtab_from_static_block
/* Create the GLOBAL_BLOCK and build the blockvector. */
finish_block_internal (NULL, get_global_symbols (), NULL, NULL,
m_last_source_start_addr, end_addr,
1, expandable);
true, expandable);
blockvector = make_blockvector ();
/* Read the line table if it has to be read separately.
@@ -1003,8 +1004,8 @@ buildsym_compunit::end_compunit_symtab (CORE_ADDR end_addr)
{
struct block *static_block;
static_block = end_compunit_symtab_get_static_block (end_addr, 0, 0);
return end_compunit_symtab_from_static_block (static_block, 0);
static_block = end_compunit_symtab_get_static_block (end_addr, false, false);
return end_compunit_symtab_from_static_block (static_block, false);
}
/* Same as end_compunit_symtab except create a symtab that can be later added
@@ -1015,8 +1016,8 @@ buildsym_compunit::end_expandable_symtab (CORE_ADDR end_addr)
{
struct block *static_block;
static_block = end_compunit_symtab_get_static_block (end_addr, 1, 0);
return end_compunit_symtab_from_static_block (static_block, 1);
static_block = end_compunit_symtab_get_static_block (end_addr, true, false);
return end_compunit_symtab_from_static_block (static_block, true);
}
/* Subroutine of augment_type_symtab to simplify it.

View File

@@ -327,10 +327,10 @@ struct buildsym_compunit
struct context_stack pop_context ();
struct block *end_compunit_symtab_get_static_block
(CORE_ADDR end_addr, int expandable, int required);
(CORE_ADDR end_addr, bool expandable, bool required);
struct compunit_symtab *end_compunit_symtab_from_static_block
(struct block *static_block, int expandable);
(struct block *static_block, bool expandable);
struct compunit_symtab *end_compunit_symtab (CORE_ADDR end_addr);
@@ -347,7 +347,7 @@ private:
struct pending_block *old_blocks,
const struct dynamic_prop *static_link,
CORE_ADDR start, CORE_ADDR end,
int is_global, int expandable);
bool is_global, bool expandable);
std::unique_ptr<blockvector> make_blockvector ();

View File

@@ -4870,7 +4870,8 @@ process_full_comp_unit (dwarf2_cu *cu)
addr = per_objfile->relocate (highpc);
static_block
= cu->get_builder ()->end_compunit_symtab_get_static_block (addr, 0, 1);
= cu->get_builder ()->end_compunit_symtab_get_static_block (addr, false,
true);
/* If the comp unit has DW_AT_ranges, it may have discontiguous ranges.
Also, DW_AT_ranges may record ranges not belonging to any child DIEs
@@ -4880,7 +4881,7 @@ process_full_comp_unit (dwarf2_cu *cu)
dwarf2_record_block_ranges (cu->dies, static_block, cu);
cust = cu->get_builder ()->end_compunit_symtab_from_static_block
(static_block, 0);
(static_block, false);
if (cust != NULL)
{