[PATCH] D114519: [clang-format] [PR52595] clang-format does not recognize rvalue references to array

Marek Kurdej via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 24 02:24:21 PST 2021


curdeius added inline comments.


================
Comment at: clang/unittests/Format/FormatTest.cpp:9662
 
+TEST_F(FormatTest, AmpAmpOperator) {
+  verifyFormat("int operator()(T (&&)[N]) { return 1; }");
----------------
Nit: these are not &/&& operators but references so the test name seems incorrect.


================
Comment at: clang/unittests/Format/FormatTest.cpp:21879
   verifyFormat("Foo::operator&&();", Style);
-  verifyFormat("operator&&(int(&&)(), class Foo);", Style);
+  verifyFormat("operator&&(int (&&)(), class Foo);", Style);
   verifyFormat("operator const nsTArrayRight<E> &()", Style);
----------------
MyDeveloperDay wrote:
> this test should be consistent with 
> 
> ```
> verifyFormat("operator&(int (&)(), class Foo);", Style);
> ```
Should we test
```
verifyFormat("operator&&(int (&)(), class Foo);", Style);
```
here, and
```
verifyFormat("operator&(int (&&)(), class Foo);", Style);
```
above as well?


================
Comment at: clang/unittests/Format/FormatTest.cpp:21940
   verifyFormat("Foo::operator&&();", Style);
-  verifyFormat("operator&&(int(&&)(), class Foo);", Style);
+  verifyFormat("operator&&(int (&&)(), class Foo);", Style);
   verifyFormat("operator const nsTArrayLeft<E>&()", Style);
----------------
Ditto for combinations of &+(&&) and &&+(&).


================
Comment at: clang/unittests/Format/FormatTest.cpp:21981
   verifyFormat("Foo::operator&&();", Style);
-  verifyFormat("operator&&(int(&&)(), class Foo);", Style);
+  verifyFormat("operator&&(int (&&)(), class Foo);", Style);
 }
----------------
Ditto.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114519



More information about the cfe-commits mailing list