c++: refactor some parser code

Nathan Sidwell nathan@acm.org
Wed Jul 15 14:42:33 GMT 2020


cp_parser_declaration copies tokens to local variables, before 
inspecting (some of) their fields.  There's no need.  Just point at them 
in the token buffer -- they don't move.  Also, we never look at the 
second token if the first is EOF, so no need for some kind of dummy 
value in that case.

             gcc/cp/
             * parser.c (cp_parser_declaration): Avoid copying tokens.
             (cp_parser_block_declaration): RAII token pointer.

pushed

-- 
Nathan Sidwell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: parse-ptr.diff
Type: text/x-patch
Size: 5546 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200715/6eec4c4a/attachment-0001.bin>


More information about the Gcc-patches mailing list