]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Avoid symbol lookup for field names in C parser
authorTom Tromey <tom@tromey.com>
Sat, 16 Aug 2025 18:21:15 +0000 (12:21 -0600)
committerTom Tromey <tom@tromey.com>
Mon, 8 Sep 2025 20:06:10 +0000 (14:06 -0600)
commit46eab380ee65ae56c8d586c6aae30cd7d248e198
tree75844fbce08345971f5b601620da32149e027375
parented1057031bd38df25878ade56740bf79b720f5e9
Avoid symbol lookup for field names in C parser

Currently, the C parser looks up any name it finds -- at lex time.
However, in an expression like "obj->field", looking up the field name
is wasteful, and can sometimes even yield pathological symtab
expansion behavior.

This patch arranges to avoid the name lookup in this case.  (It would
be nice to really clean up this area, but I'm not convinced it can
readily be done in a yacc parser.)

Some special code is required for the C++ construct where a qualified
name is used, like "obj->type1::type2::field".

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33081
gdb/c-exp.y