[PATCH] D116767: [clang-format] Fix `BraceWrapping: AfterFunction` affecting synchronized blocks in Java.

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 7 00:08:28 PST 2022


owenpan accepted this revision.
owenpan added a comment.
This revision is now accepted and ready to land.

LGTM except for the nits.



================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1528
         // for them (the one we know is missing are lambdas).
-        if (Style.BraceWrapping.AfterFunction)
+        if ((Style.Language == FormatStyle::LK_Java) &&
+            Line->Tokens.front().Tok->is(Keywords.kw_synchronized)) {
----------------
Remove redundant parens.


================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1535
+            addUnwrappedLine();
+        } else if (Style.BraceWrapping.AfterFunction)
           addUnwrappedLine();
----------------
Add braces to "keep it uniform" with the `if` block.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116767



More information about the cfe-commits mailing list