This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Don't offer suggestions for compiler-generated variables (PR c++/85515)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]