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] Add TYPE_NAME_IDENTIFIER


On 04/13/2014 12:20 PM, Paolo Carlini wrote:
this is a small clean-up discussed some time ago with Jason. The basic
idea seems pretty straightforward to me. However, at variance with that
discussion, I'm not proposing replacing the C++ front-end
TYPE_IDENTIFIER with the new TYPE_NAME_IDENTIFIER because, as far as I
can see, that front-end really needs DECL_NAME (TYPE_NAME
unconditionally. Eg, code like (in error.c):

     case TEMPLATE_TEMPLATE_PARM:
       /* For parameters inside template signature.  */
       if (TYPE_IDENTIFIER (t))
     pp_cxx_tree_identifier (pp, TYPE_IDENTIFIER (t));
       else
     pp_cxx_canonical_template_parameter (pp, t);
       break;

assumes that TYPE_IDENTIFIER is indeed an identifier and that would not
be necessarily the case in C++ when TYPE_NAME_IDENTIFIER boils down to
TYPE_NAME itself (in practice, fails like eg, abi/mangle12.C, where
TYPE_NAME is a TEMPLATE_DECL).

You could avoid that issue if TYPE_NAME_IDENTIFIER checked for IDENTIFIER_NODE rather than TYPE_DECL.

Jason


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