[PATCH] D90209: add test for PAS_Right + RAS_Left + commentedout '* &' example

Andrew Somerville via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 26 22:32:10 PDT 2020


catskul created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
catskul requested review of this revision.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90209

Files:
  clang/unittests/Format/FormatTest.cpp


Index: clang/unittests/Format/FormatTest.cpp
===================================================================
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -893,6 +893,12 @@
   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_Right;
+  Style.ReferenceAlignment = FormatStyle::RAS_Pointer;
+  verifyFormat("int *f1(int *a, int &b, int &&c);", Style);
+  verifyFormat("int &f2(int &&c, int *a, int &b);", Style);
+  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_Right;
   Style.ReferenceAlignment = FormatStyle::RAS_Left;
   verifyFormat("int *f1(int *a, int& b, int&& c);", Style);
   verifyFormat("int& f2(int&& c, int *a, int& b);", Style);
@@ -910,6 +916,9 @@
   verifyFormat("int &f2(int &&c, int * a, int &b);", Style);
   verifyFormat("int &&f3(int &b, int &&c, int * a);", Style);
   verifyFormat("int * a = f1();\nint &b = f2();\nint &&c = f3();", Style);
+
+  // we don't handle this yet, so output may be arbitrary until it's specifically handled
+  //verifyFormat("int Add2(BTree * &Root, char * szToAdd)", Style);
 }
 
 TEST_F(FormatTest, FormatsForLoop) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90209.300888.patch
Type: text/x-patch
Size: 1375 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201027/bcdc8abc/attachment.bin>


More information about the cfe-commits mailing list