[C++ PATCH] Special identifier marking

Nathan Sidwell nathan@acm.org
Thu Jun 22 18:49:00 GMT 2017


This patch starts cleaning up how we mark special identifiers.  We 
currently use some of the TREE_LANG_FLAGS on IDENTIFIER_NODEs for 
various things, but most of those things are mutually exclusive, so an 
enumeration is better -- it allows us to distinguish more things with 
fewer bits.  This patch shrinks us from using 4 bits to using 3 bits.

We were using TREE_LANG_FLAG directly, rather than checking we were 
looking at an identifier node.  It turned out that in a few places 
(mainly grokdecl and friends), we'd treat TEMPLATE_ID_EXPRs and 
BITNOT_EXPRs as-if they were identifiers.  I guess we lucked out. 
Anyway, this patch adds the checking we now expect.

Finally, the names were somewhat random, now the accessor macros are all 
IDENTIFIER_something_P.

Specifically:
   C_RESERVED_WORD_P --> IDENTIFIER_KEYWORD_P
   IDENTIFIER_CTOR_OR_DTOR_P --> IDENTIFIER_CDTOR_P
   IDENTIFIER_OPNAME_P --> IDENTIFIER_ANY_OP_P
   IDENTIFIER_TYPENAME_P --> IDENTIFIER_CONV_OP_P
(TYPENAME means something else, so it's confusing the name conversion 
operators that way).
New accessors are:
   IDENTIFIER_CTOR_P  a constructor name
   IDENTIFIER_DTOR_P  a destructor name
   IDENTIFIER_ASSIGN_OP_P any of the assignment operators
   IDENTIFIER_NEWDEL_OP_P a new or delete operator

Followup patches will take more advantage of the new features.

nathan
-- 
Nathan Sidwell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ident-flags.diff
Type: text/x-patch
Size: 43494 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20170622/0e150ee0/attachment.bin>


More information about the Gcc-patches mailing list