[PATCH] D115738: [clang-format] Fix formatting of the code that follows C# Lambda Expressions

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 15 18:18:27 PST 2021


owenpan added a comment.

Thanks for factoring the code.



================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1872
             // calling `addUnwrappedLine()` here causes odd parsing errors.
             FormatTok->MustBreakBefore = true;
           }
----------------
MyDeveloperDay wrote:
> part of me thinks the MustBreakBefore should be handled separately in TokenAnnotator::mustBreakBefore() and let it do its stuff. 
Yes, but we can take care of it in a separate patch.


================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1859
+  nextToken();
+  if (FormatTok->is(tok::l_brace)) {
+    // C# may break after => if the next character is a newline.
----------------
Early return.


================
Comment at: clang/lib/Format/UnwrappedLineParser.h:141
   bool tryToParseLambda();
+  bool tryParseCSharpLambda();
   bool tryToParseLambdaIntroducer();
----------------
To keep the naming consistent.


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

https://reviews.llvm.org/D115738



More information about the cfe-commits mailing list