[PATCH] D132911: [clang-format] Fix annotating when deleting array of pointers
Jack Huang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 30 02:53:34 PDT 2022
jackhong12 added inline comments.
================
Comment at: clang/lib/Format/TokenAnnotator.cpp:2381-2385
if (PrevToken->Tok.isLiteral() ||
PrevToken->isOneOf(tok::r_paren, tok::r_square, tok::kw_true,
tok::kw_false, tok::r_brace)) {
return TT_BinaryOperator;
}
----------------
The `*` token in `delete *x;` will be annotated as UnaryOperator (dereferencing a pointer).
In the case `delete[] *x;`, there is a `]` before `*`. So, it will be annotated as BinaryOperator by this rule.
I think both `*` here should be UnaryOperator. Therefore, I add a new rule to match the `delete[]` pattern.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132911/new/
https://reviews.llvm.org/D132911
More information about the cfe-commits
mailing list