[binutils-gdb] Unconditionally pass is_a_field_of_this in c-exp.y

Tom Tromey tromey@sourceware.org
Sun Dec 7 15:34:28 GMT 2025


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

commit 278b24151e48fc9f52a4ee85d7e6d439ce246eac
Author: Tom Tromey <tom@tromey.com>
Date:   Fri Dec 5 11:43:08 2025 -0700

    Unconditionally pass is_a_field_of_this in c-exp.y
    
    In a review to a different patch of mine, Simon asked for this change.
    The idea here is that there's no need to pass null as the "field of
    this" parameter, as lookup_language_this checks the language anyway.
    
    Approved-By: Simon Marchi <simon.marchi@efficios.com>

Diff:
---
 gdb/c-exp.y | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 829058027f3..4ea60fe54f6 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -3071,10 +3071,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
 
 	    if (lookup_symbol (copy.c_str (),
 			       pstate->expression_context_block,
-			       SEARCH_VFT,
-			       (par_state->language ()->la_language
-				== language_cplus ? &is_a_field_of_this
-				: NULL)).symbol
+			       SEARCH_VFT, &is_a_field_of_this).symbol
 		!= NULL)
 	      {
 		/* The keyword is shadowed.  */
@@ -3136,8 +3133,7 @@ classify_name (struct parser_state *par_state, const struct block *block,
   std::string copy = copy_name (yylval.sval);
 
   bsym = lookup_symbol (copy.c_str (), block, SEARCH_VFT,
-			par_state->language ()->name_of_this ()
-			? &is_a_field_of_this : NULL);
+			&is_a_field_of_this);
 
   if (bsym.symbol && bsym.symbol->loc_class () == LOC_BLOCK)
     {


More information about the Gdb-cvs mailing list