[PATCH] D123676: [clang-format] Fix WhitespaceSensitiveMacros not being honoured when macro closing parenthesis is followed by a newline.

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 13 18:36:37 PDT 2022


owenpan added inline comments.


================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1791
+            tokenCanStartNewLine(*FormatTok) && Text == Text.upper() &&
+            !PreviousToken->isTypeFinalized()) {
           PreviousToken->setFinalizedType(TT_FunctionLikeOrFreestandingMacro);
----------------
Can we simply do this and leave `FormatTokenLexer` alone?


================
Comment at: clang/unittests/Format/FormatTest.cpp:23545
+  // Newlines are important here.
+  EXPECT_EQ("FOO(1+2  );\n", format("FOO(1+2  );\n", Style));
+  EXPECT_EQ("FOO(1+2  )\n", format("FOO(1+2  )\n", Style));
----------------
Do we really need this test case?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123676



More information about the cfe-commits mailing list