[PATCH] D126758: [clang-format] Handle do-while loops for RemoveBracesLLVM
    Owen Pan via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Wed Jun  1 09:23:39 PDT 2022
    
    
  
owenpan added inline comments.
================
Comment at: clang/unittests/Format/FormatTest.cpp:25103
 
-  // The following eight test cases are fully-braced versions of the examples at
+  // The following nine test cases are fully-braced versions of the examples at
   // "llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-
----------------
curdeius wrote:
> Nit. To avoid updating it every time we add an example.
Yep. I will also remove the numbering on the examples.
================
Comment at: clang/unittests/Format/FormatTest.cpp:25407-25411
+  verifyFormat("do {\n"
+               "  ++I;\n"
+               "} while (hasMore() && Filter(*I));",
+               "do { ++I; } while (hasMore() && Filter(*I));",
+               Style);
----------------
curdeius wrote:
> What's the value of testing that newlines are added? That's not really the job of Insert/RemoveBraces.
This was from the actual llvm-project source. I used it not because I wanted to test the insertion of newlines, but because I fixed some insert/remove braces bugs related to whether the braces were wrapped.
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126758/new/
https://reviews.llvm.org/D126758
    
    
More information about the cfe-commits
mailing list