This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Don't offer suggestions for compiler-generated variables (PR c++/85515)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: David Malcolm <dmalcolm at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Jason Merrill <jason at redhat dot com>
- Date: Wed, 25 Apr 2018 17:38:43 +0200
- Subject: Re: [PATCH] Don't offer suggestions for compiler-generated variables (PR c++/85515)
- References: <1524670911-18548-1-git-send-email-dmalcolm@redhat.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Apr 25, 2018 at 11:41:51AM -0400, David Malcolm wrote:
> @@ -1224,9 +1225,19 @@ lookup_field_fuzzy_info::fuzzy_lookup_field (tree type)
>
> for (tree field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
> {
> - if (!m_want_type_p || DECL_DECLARES_TYPE_P (field))
> - if (DECL_NAME (field))
> - m_candidates.safe_push (DECL_NAME (field));
> + if (m_want_type_p && !DECL_DECLARES_TYPE_P (field))
> + continue;
> +
> + tree name = DECL_NAME (field);
> + if (name == NULL_TREE)
> + continue;
> +
> + /* FIXME: do we want to impose the underscore-uppercase rule, or
> + just two underscores here? */
> + if (name_reserved_for_implementation_p (IDENTIFIER_POINTER (name)))
> + continue;
This will not suggest fields that are really named __, there are tons of
such fields in many structures.
I think for lambdas it is better to make the fields DECL_NAMELESS (unless
debuginfo relies on them being emitted) and then check here DECL_NAMELESS.
Jakub