[PATCH] D147969: Add InsertBraces to ChromiumStyle

2023-04-10 Thread Peter Boström via Phabricator via cfe-commits
pbos created this revision.
pbos added a reviewer: hans.
Herald added projects: All, clang, clang-format.
Herald added a subscriber: cfe-commits.
Herald added reviewers: rymiel, HazardyKnusperkeks, owenpan, MyDeveloperDay.
pbos requested review of this revision.
Herald added a comment.

NOTE: Clang-Format Team Automated Review Comment

It looks like your clang-format review does not contain any unit tests, please 
try to ensure all code changes have a unit test (unless this is an `NFC` or 
refactoring, adding documentation etc..)

Add your unit tests in `clang/unittests/Format` and you can build with `ninja 
FormatTests`.  We recommend using the `verifyFormat(xxx)` format of unit tests 
rather than `EXPECT_EQ` as this will ensure you change is tolerant to random 
whitespace changes (see FormatTest.cpp as an example)

For situations where your change is altering the TokenAnnotator.cpp which can 
happen if you are trying to improve the annotation phase to ensure we are 
correctly identifying the type of a token, please add a token annotator test in 
`TokenAnnotatorTest.cpp`


This style change is tracked in https://crbug.com/1392808 and has been
in repo since crrev.com/c/4097043 in Dec 13, 2022.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147969

Files:
  clang/lib/Format/Format.cpp


Index: clang/lib/Format/Format.cpp
===
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -1696,6 +1696,7 @@
 ChromiumStyle.AllowShortLoopsOnASingleLine = false;
 ChromiumStyle.BinPackParameters = false;
 ChromiumStyle.DerivePointerAlignment = false;
+ChromiumStyle.InsertBraces = true;
 if (Language == FormatStyle::LK_ObjC)
   ChromiumStyle.ColumnLimit = 80;
   }


Index: clang/lib/Format/Format.cpp
===
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -1696,6 +1696,7 @@
 ChromiumStyle.AllowShortLoopsOnASingleLine = false;
 ChromiumStyle.BinPackParameters = false;
 ChromiumStyle.DerivePointerAlignment = false;
+ChromiumStyle.InsertBraces = true;
 if (Language == FormatStyle::LK_ObjC)
   ChromiumStyle.ColumnLimit = 80;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147969: Add InsertBraces to ChromiumStyle

2023-04-10 Thread Peter Boström via Phabricator via cfe-commits
pbos added a comment.

Does this need additional testing besides 
clang/unittests/Format/BracesInserterTest.cpp ?

I haven't seen tests that EXPECT_TRUE(getChromiumStyle(lang).InsertBraces);


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147969

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147969: Add InsertBraces to ChromiumStyle

2023-04-10 Thread Peter Boström via Phabricator via cfe-commits
pbos added a comment.

What defines a code-modifying feature? This shouldn't change control flow, so 
are superfluous {}s seen as code-modifying while additional spaces/tabs/whatnot 
are not?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147969

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D147969: Add InsertBraces to ChromiumStyle

2023-04-10 Thread Peter Boström via Phabricator via cfe-commits
pbos added a comment.

That's reasonable. If I don't hear something else we'll own InsertBraces on our 
end. Is there anything I can point to regarding the decision to not let 
clang-format add/rearrange tokens by default so that I can refer to that in a 
comment saying why it won't be upstreamed?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147969

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits