[LTO merge][4/15][RFA] C++ front end

Mark Mitchell mark@codesourcery.com
Tue Sep 29 22:08:00 GMT 2009


Diego Novillo wrote:

>>  if ((TREE_CODE (decl) == FUNCTION_DECL
>>       || TREE_CODE (decl) == VAR_DECL)
>>      && (DECL_TEMPLATE_INSTANTIATION (decl)
>>          || DECL_TEMPLATE_SPECIALIZATION (decl)))
> 
> Because I have no idea what I'm doing here.  I coded this by trial and
> error from a gdb session.

We may need to send you to C++ re-education so that you can make sense
of this stuff. :-)

> No.  In fact, I will change that check to an assertion,
> need_assembler_name_p always rejects anything that's not a VAR_DECL or
> a FUNCTION_DECL.

OK, good; then you're just checking for INSTANTIATION or SPECIALIZATION
which is logical.

>>> +      /* Member friend templates do not need assembler names.  */
>>> +      if (TREE_CODE (DECL_TI_TEMPLATE (decl)) == IDENTIFIER_NODE
>>> +       || TREE_CODE (DECL_TI_TEMPLATE (decl)) == OVERLOAD)
>>> +     return false;
>> Do we want DECL_MEMBER_TEMPLATE_P here?  Why is this hook seeing member
>> templates?
> 
> Jason suggested using uses_template_parms.  Is that enough?

I'm not sure, because I don't quite get what you're trying to avoid.
uses_template_parms ends up meaning "somehow involves template
parameters" rather than the more well-defined C++ language semantic
notion of "depends on a template parameter".  So, I don't very much like
uses_template_parms, but maybe it's the right answer.  There should be
some semantic way to explain what class of entities you're trying to
exclude.

Thanks,

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc-patches mailing list