[RFC] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)
Jason Merrill
jason@redhat.com
Tue Nov 16 20:49:31 GMT 2021
On 11/16/21 15:42, Matthias Kretz wrote:
> On Tuesday, 16 November 2021 21:25:33 CET Jason Merrill wrote:
>> On 11/8/21 15:00, Matthias Kretz wrote:
>>> I forgot to mention why I tagged it [RFC]: I needed one more bit of
>>> information on the template args TREE_VEC to encode
>>> EXPLICIT_TEMPLATE_ARGS_P. Its TREE_CHAIN already points to an integer
>>> constant denoting the number of non-default arguments, so I couldn't
>>> trivially replace that. Therefore, I used the sign of that integer. I was
>>> hoping to find a cleaner solution, though.
>> It seems that we aren't using any TREE_LANG_FLAG_n on TREE_VEC, so that
>> would be a cleaner solution.
>
> I tried that first but realized that TREE_VEC doesn't allow any
> TREE_LANG_FLAGs (it uses those bits for the length IIRC). And setting the
> TREE_LANG_FLAGs on the TREE_CHAIN of the TREE_VEC can't work either (since the
> int constants are shared between many trees).
>
> Should I maybe turn the TREE_CHAIN into a TREE_LIST using TREE_PURPOSE and
> TREE_VALUE for EXPLICIT_TEMPLATE_ARGS_P and non-default arguments,
> respectively? (And where would I document this?)
Maybe a TREE_LIST if there are explicit template arguments to a function
template, where TREE_PURPOSE is the number of explicit arguments and
TREE_VALUE is the number of non-default arguments.
I'd document it at the definition of NON_DEFAULT_TEMPLATE_ARGS_COUNT.
The SET/GET macros should become functions.
Jason
More information about the Gcc-patches
mailing list