[PATCH] D121754: [clang-format] Refactor determineStarAmpUsage

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 16 13:30:39 PDT 2022


HazardyKnusperkeks requested changes to this revision.
HazardyKnusperkeks added inline comments.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:2161
 
-    if (PrevToken->isOneOf(tok::l_paren, tok::l_square, tok::l_brace,
-                           tok::comma, tok::semi, tok::kw_return, tok::colon,
-                           tok::kw_co_return, tok::kw_co_await,
-                           tok::kw_co_yield, tok::equal, tok::kw_delete,
-                           tok::kw_sizeof, tok::kw_throw, TT_BinaryOperator,
-                           TT_ConditionalExpr, TT_UnaryOperator, TT_CastRParen))
+    if (determinePlusMinusCaretUsage(Tok) == TT_UnaryOperator)
       return TT_UnaryOperator;
----------------
curdeius wrote:
> As below, before, question, kw_return, kw_case, at were not handled here.
> Please add tests.
This needs a comment or better a new common function. Otherwise it's just unnecessary hard to understand why we now check for PlusMinusCaret. (I've never heard of this function and I've stepped a lot through clang-format. ;))


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121754/new/

https://reviews.llvm.org/D121754



More information about the cfe-commits mailing list