diff options
author | Nathan Sidwell <nathan@acm.org> | 2020-10-02 11:13:26 -0700 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2020-10-02 11:22:42 -0700 |
commit | 7ee1c0413e251ff0b6a6d526209ef038b9835320 (patch) | |
tree | 81c76e02ae7706afc52b305cdfc3fc0cd738b77f /gcc/cp/decl.c | |
parent | 9340d1c97b8a7aa47aff677f9b6db4799670f47b (diff) | |
download | gcc-7ee1c0413e251ff0b6a6d526209ef038b9835320.zip gcc-7ee1c0413e251ff0b6a6d526209ef038b9835320.tar.gz gcc-7ee1c0413e251ff0b6a6d526209ef038b9835320.tar.bz2 |
c++: Hash table iteration for namespace-member spelling suggestions
For 'no such binding' errors, we iterate over binding levels to find a
close match. At the namespace level we were using DECL_ANTICIPATED to
skip undeclared builtins. But (a) there are other unnameable things
there and (b) decl-anticipated is about to go away. This changes the
namespace scanning to iterate over the hash table, and look at
non-hidden bindings. This does mean we look at fewer strings
(hurrarh), but the order we meet them is somewhat 'random'. Our
distance measure is not very fine grained, and a couple of testcases
change their suggestion. I notice for the c/c++ common one, we now
match the output of the C compiler. For the other one we think 'int'
and 'int64_t' have the same distance from 'int64', and now meet the
former first. That's a little unfortunate. If it's too problematic I
suppose we could sort the strings via an intermediate array before
measuring distance.
gcc/cp/
* name-lookup.c (consider_decl): New, broken out of ...
(consider_binding_level): ... here. Iterate the hash table for
namespace bindings.
gcc/testsuite/
* c-c++-common/spellcheck-reserved.c: Adjust diagnostic.
* g++.dg/spellcheck-typenames.C: Adjust diagnostic.
Diffstat (limited to 'gcc/cp/decl.c')
0 files changed, 0 insertions, 0 deletions