[PATCH] D72401: Fixes for spaces around C# object initializers

Krasimir Georgiev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 13 00:06:39 PST 2020


krasimir added inline comments.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:2869
+    // space before '{' in "new MyType {"
+    if (Left.is(TT_Unknown) && Right.is(tok::l_brace) && Left.Previous &&
+        Left.Previous->is(tok::kw_new))
----------------
krasimir wrote:
> This test feels a bit too rigid: you might additionally want to consider `new Type<Param> {` and `new Type /*comment*/ {` and `new [] /* comment */ {`.
> For these you might find the `MatchingParen` and `getPreviousNonComment` useful. And example for this is below, at line 2880-2885 in javascript handling.
Sorry, disregard the patterns with `/* comment */` above. I guess the spaces around the comment there are enforced at another place.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72401





More information about the cfe-commits mailing list