[PATCH] D137327: [clang-format] Handle object instansiation in if-statements

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 3 14:46:56 PDT 2022


HazardyKnusperkeks added inline comments.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:366
+              CurrentToken->is(tok::identifier) &&
+              !Next->isOneOf(tok::equal, tok::l_brace)) {
             Prev->setType(TT_BinaryOperator);
----------------
Could you add a test for this as well?


================
Comment at: clang/unittests/Format/TokenAnnotatorTest.cpp:1038
 
+TEST_F(TokenAnnotatorTest, UnderstandIfInitializer) {
+  auto Tokens = annotate("if (Class* obj {getObj()}) ");
----------------
There is already a test case for star amp understanding, please use that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137327



More information about the cfe-commits mailing list