[PATCH] D115738: [clang-format] Code following C# Lambda Expressions has wrong formatting

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 14 12:58:47 PST 2021


owenpan added inline comments.


================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2007
+        if (FormatTok->is(tok::l_brace)) {
+          if (Style.isCSharp() && Style.BraceWrapping.AfterFunction == true) {
+            FormatTok->MustBreakBefore = true;
----------------
You already tested for C# on line 2004.


================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2009
+            FormatTok->MustBreakBefore = true;
+          }
+          parseChildBlock();
----------------
Remove braces.


================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2012
+        }
+      } else
         nextToken();
----------------
Add braces after `else` to match `if`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115738



More information about the cfe-commits mailing list