[PATCH] D90238: [clang-format] Added ReferenceAlignmentStyle option - (Update to D31635)

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 7 10:43:09 PST 2020


MyDeveloperDay added a comment.

Looks almost there, just a few nits really



================
Comment at: clang/docs/ClangFormatStyleOptions.rst:2316
 
+**ReferenceAlignment** (``ReferenceAlignmentStyle``)
+  Reference alignment style (overrides ``PointerAlignment`` for
----------------
Did you generate this file by running clang/doc/tools/dump_style.py or make it by hand? changes in Format.h should make some sort of change here


================
Comment at: clang/include/clang/Format/Format.h:1891
 
-  /// The ``&`` and ``*`` alignment style.
+  /// The ``&``, ``&&`` and ``*`` alignment style.
   enum PointerAlignmentStyle {
----------------
wondering why this didn't cause an rst change above


================
Comment at: clang/lib/Format/Format.cpp:993
   GoogleStyle.PointerAlignment = FormatStyle::PAS_Left;
+  GoogleStyle.ReferenceAlignment = FormatStyle::RAS_Pointer;
   GoogleStyle.RawStringFormats = {
----------------
I sort of feel you only need this in the base LLVMStyle?


================
Comment at: clang/lib/Format/Format.cpp:1185
   MozillaStyle.PointerAlignment = FormatStyle::PAS_Left;
+  MozillaStyle.ReferenceAlignment = FormatStyle::RAS_Pointer;
   MozillaStyle.SpaceAfterTemplateKeyword = false;
----------------
I sort of feel you only need this in the base LLVMStyle?


================
Comment at: clang/lib/Format/Format.cpp:1208
   Style.PointerAlignment = FormatStyle::PAS_Left;
+  Style.ReferenceAlignment = FormatStyle::RAS_Pointer;
   Style.SpaceBeforeCpp11BracedList = true;
----------------
I sort of feel you only need this in the base LLVMStyle?


================
Comment at: clang/lib/Format/TokenAnnotator.h:192
 
+  FormatStyle::PointerAlignmentStyle
+  getTokenPointerAlignment(const FormatToken &PointerOrReference);
----------------
do you need FormatStyle:: here?


================
Comment at: clang/unittests/Format/FormatTest.cpp:889
+  FormatStyle Style = getLLVMStyle();
+  Style.PointerAlignment = FormatStyle::PAS_Left;
+  Style.ReferenceAlignment = FormatStyle::RAS_Pointer;
----------------
you shouldn't need these right, lets test the default LLVM style without setting it to something else


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90238



More information about the cfe-commits mailing list