[PATCH] D104096: [Clang-Format] Add ReferenceAlignment directive

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 11 09:46:01 PDT 2021


MyDeveloperDay added a comment.

A new nits but I'd say it was pretty good.



================
Comment at: clang/lib/Format/Format.cpp:1356
   Style.PointerAlignment = FormatStyle::PAS_Left;
+  Style.ReferenceAlignment = FormatStyle::RAS_Pointer;
   Style.SpaceBeforeCpp11BracedList = true;
----------------
if we are inheriting from LLVM we only need this in the LLVM base tyle


================
Comment at: clang/unittests/Format/FormatTest.cpp:1243
+  verifyFormat("int *f1(int &a) const & = 0;", Style);
+  verifyFormat("int *a = f1();\nint &b = f2();\nint &&c = f3();", Style);
+  Style.PointerAlignment = FormatStyle::PAS_Left;
----------------
could you put each line on its own line. makes it easier to reason about


================
Comment at: clang/unittests/Format/FormatTest.cpp:1250
+  verifyFormat("int* f1(int& a) const& = 0;", Style);
+  verifyFormat("int* a = f1();\nint& b = f2();\nint&& c = f3();", Style);
+  Style.PointerAlignment = FormatStyle::PAS_Right;
----------------
ditto


================
Comment at: clang/unittests/Format/FormatTest.cpp:1256
+  verifyFormat("int&& f3(int& b, int&& c, int *a);", Style);
+  verifyFormat("int *a = f1();\nint& b = f2();\nint&& c = f3();", Style);
+  Style.PointerAlignment = FormatStyle::PAS_Left;
----------------
ditto


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104096



More information about the cfe-commits mailing list