In Parser::ParseDirectDeclarator(...) in some cases ill-formed code can cause an annotation token to end up where it was not expected. The fix is to add a !Tok.isAnnotation() guard before attempting to access identifier info.
This fixes:
Differential D158804
[Clang] Fix crash in Parser::ParseDirectDeclarator by adding check that token is not an annotation token shafik on Aug 24 2023, 7:27 PM. Authored by
Details In Parser::ParseDirectDeclarator(...) in some cases ill-formed code can cause an annotation token to end up where it was not expected. The fix is to add a !Tok.isAnnotation() guard before attempting to access identifier info. This fixes:
Diff Detail
Event TimelineComment Actions I'm not well versed in the parser code, but the fix clearly avoids the assertion in getIdentifierInfo(), and both @aaron.ballman and @rjmccall indicated in the issue discussion that this fix is appropriate, so I will take the liberty of approving this. |