]> Git Repo - binutils.git/commitdiff
gdb: remove COMPUNIT_MACRO_TABLE macro, add getter/setter
authorSimon Marchi <[email protected]>
Sat, 20 Nov 2021 03:43:56 +0000 (22:43 -0500)
committerSimon Marchi <[email protected]>
Sun, 6 Feb 2022 20:48:19 +0000 (15:48 -0500)
Add a getter and a setter for a compunit_symtab's macro table.  Remove the
corresponding macro and adjust all callers.

Change-Id: I00615ea72d5ac43d9a865e941cb2de0a979c173a

gdb/buildsym.c
gdb/macroscope.c
gdb/mi/mi-cmd-file.c
gdb/source.c
gdb/symtab.h

index 1b162dac9e07e87039b22649936ade969cbd84b5..b42c40830c9082418014d3beefdd3b17612614dd 100644 (file)
@@ -1024,7 +1024,7 @@ buildsym_compunit::end_symtab_with_blockvector (struct block *static_block,
 
   cu->set_block_line_section (section);
 
-  COMPUNIT_MACRO_TABLE (cu) = release_macros ();
+  cu->set_macro_table (release_macros ());
 
   /* Default any symbols without a specified symtab to the primary symtab.  */
   {
index 02070967579f4f5fa5470091f9ff6436476883ef..c581c426eda094a59625531f11c2eed519166cc9 100644 (file)
@@ -44,12 +44,12 @@ sal_macro_scope (struct symtab_and_line sal)
   if (sal.symtab == NULL)
     return NULL;
   cust = SYMTAB_COMPUNIT (sal.symtab);
-  if (COMPUNIT_MACRO_TABLE (cust) == NULL)
+  if (cust->macro_table () == NULL)
     return NULL;
 
   gdb::unique_xmalloc_ptr<struct macro_scope> ms (XNEW (struct macro_scope));
 
-  main_file = macro_main (COMPUNIT_MACRO_TABLE (cust));
+  main_file = macro_main (cust->macro_table ());
   inclusion = macro_lookup_inclusion (main_file, sal.symtab->filename);
 
   if (inclusion)
index 23c6d7021e2e90ad5dfc38e7bc40b137a8e1b715..f4ee791f17b531e119acca12835c6afb480f7fff 100644 (file)
@@ -59,7 +59,7 @@ mi_cmd_file_list_exec_source_file (const char *command, char **argv, int argc)
   uiout->field_string ("fullname", symtab_to_fullname (st.symtab));
 
   uiout->field_signed ("macro-info",
-                      COMPUNIT_MACRO_TABLE (SYMTAB_COMPUNIT (st.symtab)) != NULL);
+                      SYMTAB_COMPUNIT (st.symtab)->macro_table () != NULL);
 }
 
 /* Implement -file-list-exec-source-files command.  */
index 07ea2af9fd853e7f4db326328de48b390f779371..e6ba4481941382e48bc2ca0d7a9d7f861dc355e6 100644 (file)
@@ -729,8 +729,8 @@ info_source_command (const char *ignore, int from_tty)
   printf_filtered (_("Compiled with %s debugging format.\n"),
                   cust->debugformat ());
   printf_filtered (_("%s preprocessor macro info.\n"),
-                  COMPUNIT_MACRO_TABLE (cust) != NULL
-                  ? "Includes" : "Does not include");
+                  (cust->macro_table () != nullptr
+                   ? "Includes" : "Does not include"));
 }
 \f
 
index 5419e70ced6a632edf3ca0ab1d4fc15f925c235b..c319d51a2714fca8306d40118b837bf01d6c6b5b 100644 (file)
@@ -1551,6 +1551,16 @@ struct compunit_symtab
     m_epilogue_unwind_valid = epilogue_unwind_valid;
   }
 
+  struct macro_table *macro_table () const
+  {
+    return m_macro_table;
+  }
+
+  void set_macro_table (struct macro_table *macro_table)
+  {
+    m_macro_table = macro_table;
+  }
+
   /* Make PRIMARY_FILETAB the primary filetab of this compunit symtab.
 
      PRIMARY_FILETAB must already be a filetab of this compunit symtab.  */
@@ -1626,7 +1636,7 @@ struct compunit_symtab
      is shared between different symtabs in a given compilation unit.
      It's debatable whether it *should* be shared among all the symtabs in
      the given compilation unit, but it currently is.  */
-  struct macro_table *macro_table;
+  struct macro_table *m_macro_table;
 
   /* If non-NULL, then this points to a NULL-terminated vector of
      included compunits.  When searching the static or global
@@ -1646,8 +1656,6 @@ struct compunit_symtab
 
 using compunit_symtab_range = next_range<compunit_symtab>;
 
-#define COMPUNIT_MACRO_TABLE(cust) ((cust)->macro_table)
-
 /* Return the language of CUST.  */
 
 extern enum language compunit_language (const struct compunit_symtab *cust);
This page took 0.045535 seconds and 4 git commands to generate.