[PATCH] D134334: [Clang] Fix crash in isCXXDeclarationSpecifier when attempting to annotate template name
Corentin Jabot via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 1 12:31:11 PDT 2023
cor3ntin added inline comments.
================
Comment at: clang/lib/Parse/ParseTentative.cpp:1553-1554
return TPResult::Error;
- if (Tok.isNot(tok::identifier))
+ if (NextToken().isNot(tok::identifier))
break;
}
----------------
rsmith wrote:
> This doesn't seem correct to me. If we had `scope::foo bar`, and we annotate `scope::foo` as a type, then this will get confused by the next token now being an (unrelated) identifier. This code is trying to detect if an annotation was performed, so I think it intended to check if the current token's kind has changed, like is done on line 1295.
The confusing bit is that Tok is always an annotated scope already here (L1598), so TryAnnotateName should not modify that first token (unless TryAnnotateTypeOrScopeTokenAfterScopeSpec can somehow replace the current annot_cxxscope by another one, which i don't think can happen?)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134334/new/
https://reviews.llvm.org/D134334
More information about the cfe-commits
mailing list