[PATCH] D44449: [Parser] Fix assertion-on-invalid for unexpected typename.

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 13 15:38:05 PDT 2018


vsapsai added a comment.

I had performance considerations regarding this change because `ConsumeAnyToken` is heavier than `ConsumeToken`. But I didn't notice any problems. If you know this is a hot path that deserves more attention, please let me know.



================
Comment at: clang/lib/Parse/ParseDecl.cpp:3076
         DS.SetRangeEnd(Tok.getAnnotationEndLoc());
         ConsumeAnnotationToken(); // The typename
       }
----------------
Here we potentially can leave annotation token unconsumed. But I wasn't able to create a test case that would trigger a problem at this point.


================
Comment at: clang/lib/Parse/ParseDecl.cpp:3148
       DS.SetRangeEnd(Tok.getAnnotationEndLoc());
       ConsumeAnnotationToken(); // The typename
 
----------------
We didn't consume the annotation token because of `break` on `isInvalid` a few lines above.


https://reviews.llvm.org/D44449





More information about the cfe-commits mailing list