[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
Thu Apr 14 02:11:51 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);
----------------
curdeius wrote:
> owenpan wrote:
> > Can we simply do this and leave `FormatTokenLexer` alone?
> We can too. It seemed hacky to me because we can miss `TT_UntouchableMacroFunc` in other places.
> Setting the token type finalized in the lexer will avoid such problems in the future.
> I'm okay however to just apply your suggestion.
> We can too. It seemed hacky to me because we can miss `TT_UntouchableMacroFunc` in other places.
> Setting the token type finalized in the lexer will avoid such problems in the future.

Yeah. Please see my [[ https://reviews.llvm.org/D123676#3451098 | comment ]] above though.


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