Convert block_inlined_p to method
authorTom Tromey <tom@tromey.com>
Tue, 17 Jan 2023 00:27:28 +0000 (17:27 -0700)
committerTom Tromey <tom@tromey.com>
Sun, 19 Feb 2023 19:51:05 +0000 (12:51 -0700)
This converts block_inlined_p to be a method.  This was mostly written
by script.

gdb/block.c
gdb/block.h
gdb/blockframe.c
gdb/findvar.c
gdb/inline-frame.c
gdb/symtab.c

index b9c48e79d469f0d7026a1b83392465f958c338f7..574086aa4f6b29cca57403f75465d25c71013e8a 100644 (file)
@@ -77,7 +77,7 @@ contained_in (const struct block *a, const struct block *b,
        return true;
       /* If A is a function block, then A cannot be contained in B,
         except if A was inlined.  */
-      if (!allow_nested && a->function () != NULL && !block_inlined_p (a))
+      if (!allow_nested && a->function () != NULL && !a->inlined_p ())
        return false;
       a = a->superblock ();
     }
@@ -95,7 +95,7 @@ contained_in (const struct block *a, const struct block *b,
 struct symbol *
 block_linkage_function (const struct block *bl)
 {
-  while ((bl->function () == NULL || block_inlined_p (bl))
+  while ((bl->function () == NULL || bl->inlined_p ())
         && bl->superblock () != NULL)
     bl = bl->superblock ();
 
@@ -116,12 +116,12 @@ block_containing_function (const struct block *bl)
   return bl->function ();
 }
 
-/* Return one if BL represents an inlined function.  */
+/* See block.h.  */
 
-int
-block_inlined_p (const struct block *bl)
+bool
+block::inlined_p () const
 {
-  return bl->function () != NULL && bl->function ()->is_inlined ();
+  return function () != nullptr && function ()->is_inlined ();
 }
 
 /* A helper function that checks whether PC is in the blockvector BL.
index b9f1ba81b50068e1bdbd95d3cb7c0ba01736ed98..ab343b446981dfb34ddc75b58afa4abbdc3ee239 100644 (file)
@@ -212,6 +212,10 @@ struct block
 
   struct gdbarch *gdbarch () const;
 
+  /* Return true if BL represents an inlined function.  */
+
+  bool inlined_p () const;
+
   /* Addresses in the executable code that are in this block.  */
 
   CORE_ADDR m_start;
@@ -343,8 +347,6 @@ extern struct symbol *block_linkage_function (const struct block *);
 
 extern struct symbol *block_containing_function (const struct block *);
 
-extern int block_inlined_p (const struct block *block);
-
 /* Return true if block A is lexically nested within block B, or if a
    and b have the same pc range.  Return false otherwise.  If
    ALLOW_NESTED is true, then block A is considered to be in block B
index 071254824b00af5dd5d12bd2c2e4f74033c5d4a7..2796fc99154dc5c1a3a863225283781afc76af6f 100644 (file)
@@ -72,7 +72,7 @@ get_frame_block (frame_info_ptr frame, CORE_ADDR *addr_in_block)
 
   while (inline_count > 0)
     {
-      if (block_inlined_p (bl))
+      if (bl->inlined_p ())
        inline_count--;
 
       bl = bl->superblock ();
index 7006500574c2da2439defdd551d08ba386b3c9b2..528181d4f01a6bf30bb1cfa0fa304b0f2c91e25e 100644 (file)
@@ -533,7 +533,7 @@ get_hosting_frame (struct symbol *var, const struct block *var_block,
       if (frame == NULL)
        {
          if (var_block->function ()
-             && !block_inlined_p (var_block)
+             && !var_block->inlined_p ()
              && var_block->function ()->print_name ())
            error (_("No frame is currently executing in block %s."),
                   var_block->function ()->print_name ());
index f02f6353c640b4d61d748cf123b7fd45edc26d83..21431a280fae089f269708e2e91b234e193c1014 100644 (file)
@@ -228,7 +228,7 @@ inline_frame_sniffer (const struct frame_unwind *self,
   cur_block = frame_block;
   while (cur_block->superblock ())
     {
-      if (block_inlined_p (cur_block))
+      if (cur_block->inlined_p ())
        depth++;
       else if (cur_block->function () != NULL)
        break;
@@ -357,7 +357,7 @@ skip_inline_frames (thread_info *thread, bpstat *stop_chain)
       cur_block = frame_block;
       while (cur_block->superblock ())
        {
-         if (block_inlined_p (cur_block))
+         if (cur_block->inlined_p ())
            {
              /* See comments in inline_frame_this_id about this use
                 of BLOCK_ENTRY_PC.  */
index 7b7e52505efc7a317f0c9628bb6791a863e6831c..52043e4de0629bb6d007a562461fd50348c85e84 100644 (file)
@@ -2182,7 +2182,7 @@ lookup_local_symbol (const char *name,
            return blocksym;
        }
 
-      if (block->function () != NULL && block_inlined_p (block))
+      if (block->function () != NULL && block->inlined_p ())
        break;
       block = block->superblock ();
     }
@@ -3897,7 +3897,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
   function_block = NULL;
   while (b != NULL)
     {
-      if (b->function () != NULL && block_inlined_p (b))
+      if (b->function () != NULL && b->inlined_p ())
        function_block = b;
       else if (b->function () != NULL)
        break;
@@ -3993,7 +3993,7 @@ skip_prologue_using_sal (struct gdbarch *gdbarch, CORE_ADDR func_addr)
          bl = block_for_pc (prologue_sal.end);
          while (bl)
            {
-             if (block_inlined_p (bl))
+             if (bl->inlined_p ())
                break;
              if (bl->function ())
                {
@@ -5856,7 +5856,7 @@ default_collect_symbol_completion_matches_break_on
        /* Stop when we encounter an enclosing function.  Do not stop for
           non-inlined functions - the locals of the enclosing function
           are in scope for a nested function.  */
-       if (b->function () != NULL && block_inlined_p (b))
+       if (b->function () != NULL && b->inlined_p ())
          break;
        b = b->superblock ();
       }