Add two convenience methods to block
[binutils-gdb.git] / gdb / block.h
index 3a197e637549c9abea7fc3c5082d2f1a8dab8cbc..9fccbe02b9902aa923d186626d06144a6c3f8cd6 100644 (file)
@@ -254,10 +254,25 @@ struct block : public allocate_on_obstack
 
   const struct block *static_block () const;
 
+  /* Return true if this block is a static block.  */
+
+  bool is_static_block () const
+  {
+    const block *sup = superblock ();
+    if (sup == nullptr)
+      return false;
+    return sup->is_global_block ();
+  }
+
   /* Return the static block associated with block.  */
 
   const struct block *global_block () const;
 
+  /* Return true if this block is a global block.  */
+
+  bool is_global_block () const
+  { return superblock () == nullptr; }
+
   /* Set the compunit of this block, which must be a global block.  */
 
   void set_compunit_symtab (struct compunit_symtab *);