[PATCH] D90238: Update to D31635

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


MyDeveloperDay added inline comments.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:2832
       (!Left.is(TT_PointerOrReference) ||
-       (Style.PointerAlignment != FormatStyle::PAS_Right &&
+       (getTokenPointerAlignment(Left) != FormatStyle::PAS_Right &&
         !Line.IsMultiVariableDeclStmt)))
----------------
I get that this is `getReferenceOrPointAlignment(Left)`... but see below... (to be continued)


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:3332
     return !Left.isOneOf(tok::amp, tok::ampamp) ||
-           Style.PointerAlignment != FormatStyle::PAS_Right;
+           getTokenPointerAlignment(Left) != FormatStyle::PAS_Right;
   // Space before & or && following a TT_StructuredBindingLSquare.
----------------
this is `getPointerAlignment(Left)` and...  (to be continued)


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:3336
       Right.isOneOf(tok::amp, tok::ampamp))
-    return Style.PointerAlignment != FormatStyle::PAS_Left;
+    return getTokenPointerAlignment(Right) != FormatStyle::PAS_Left;
   if ((Right.is(TT_BinaryOperator) && !Left.is(tok::l_paren)) ||
----------------
and this is `getReferenceAlignment(Left)` 

I get it that it was easier to change all the function to the same function probably as a "copy and paste" of `... 
 Style.PointerAlginment ....`

but do you think it might be worth ensuring we differentiate between Pointer,Reference and PointerOrReference alignment? 


================
Comment at: clang/unittests/Format/FormatTest.cpp:920
+
+  // we don't handle this yet, so output may be arbitrary until it's specifically handled
+  //verifyFormat("int Add2(BTree * &Root, char * szToAdd)", Style);
----------------
Nit: add FIXME


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