[binutils-gdb] gdb: remote SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION macro

Simon Marchi simark@sourceware.org
Sun Feb 6 21:11:09 GMT 2022


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f5abd8f234426bbe8ccd08c43e6ae7cbe635e042

commit f5abd8f234426bbe8ccd08c43e6ae7cbe635e042
Author: Simon Marchi <simon.marchi@efficios.com>
Date:   Thu Jan 27 22:13:40 2022 -0500

    gdb: remote SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION macro
    
    Add a getter for a whether a symbol is a C++ template function.  Remove
    the corresponding macro and adjust all callers.
    
    Change-Id: I89abc2802a952b77b0e0eb73a25c2306cb8e8bcc

Diff:
---
 gdb/cp-namespace.c | 2 +-
 gdb/symtab.h       | 9 ++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index 6130381fdd6..8fb2f71b46c 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -519,7 +519,7 @@ cp_lookup_symbol_imports_or_template (const char *scope,
   if (function != NULL && function->language () == language_cplus)
     {
       /* Search the function's template parameters.  */
-      if (SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION (function))
+      if (function->is_cplus_template_function ())
 	{
 	  struct template_symbol *templ
 	    = (struct template_symbol *) function;
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 9b7d7e35c97..a86145198fd 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1198,6 +1198,11 @@ struct symbol : public general_symbol_info, public allocate_on_obstack
     m_is_inlined = is_inlined;
   }
 
+  bool is_cplus_template_function () const
+  {
+    return this->subclass == SYMBOL_TEMPLATE;
+  }
+
   /* Data type of value */
 
   struct type *type = nullptr;
@@ -1300,8 +1305,6 @@ struct block_symbol
 /* Note: There is no accessor macro for symbol.owner because it is
    "private".  */
 
-#define SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION(symbol) \
-  (((symbol)->subclass) == SYMBOL_TEMPLATE)
 #define SYMBOL_TYPE(symbol)		(symbol)->type
 #define SYMBOL_LINE(symbol)		(symbol)->line
 #define SYMBOL_COMPUTED_OPS(symbol)	((symbol)->impl ().ops_computed)
@@ -1342,7 +1345,7 @@ extern void symbol_set_symtab (struct symbol *symbol, struct symtab *symtab);
 
 /* An instance of this type is used to represent a C++ template
    function.  A symbol is really of this type iff
-   SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION is true.  */
+   symbol::is_cplus_template_function is true.  */
 
 struct template_symbol : public symbol
 {


More information about the Gdb-cvs mailing list