[PATCH] D154484: [clang-format] Add an option to remove redundant parentheses

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 6 21:26:07 PDT 2023


owenpan marked an inline comment as done.
owenpan added a comment.

In D154484#4475377 <https://reviews.llvm.org/D154484#4475377>, @MyDeveloperDay wrote:

> I reckon you could detect the `=` condition between the matching paren don't you?

Absolutely.



================
Comment at: clang/docs/ClangFormatStyleOptions.rst:4363
+
+  * ``RPS_DoubleParentheses`` (in configuration: ``DoubleParentheses``)
+    Replace double, triple, etc. parentheses with single parentheses.
----------------
MyDeveloperDay wrote:
> Honestly I'm fine with this as it is but should this be? to describe what it will become?
> 
> e.g. "SingleParentheses"
Renamed it to `MultipleParentheses`, which means to remove redundant parentheses found in multiple (double, triple, etc.) parens.  (The comment on line 3372 in Format.h says `Types of redundant parentheses to remove`, but it's changed to `Possible values` by dump_format_style.py in the documentation.) This is IMO more consistent with `ReturnStatement` below, but I'm open to other suggestions.


================
Comment at: clang/unittests/Format/FormatTest.cpp:25808
 
+TEST_F(FormatTest, RemoveParentheses) {
+  FormatStyle Style = getLLVMStyle();
----------------
HazardyKnusperkeks wrote:
> Should check for `__attribute((what ever))__`.
What's special about this? It's agnostic about this option as it should be.


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

https://reviews.llvm.org/D154484



More information about the cfe-commits mailing list