[PATCH] D121757: [clang-format] Take out common code for parsing blocks NFC

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 29 21:32:18 PDT 2022


owenpan added a comment.

In D121757#3415402 <https://reviews.llvm.org/D121757#3415402>, @sstwcw wrote:

> I ran check-clang after formatting the entire code base with the new version.  It turned out it did break some tests.  It seems to be because it messed up these comments.
>
>   diff --git a/clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.fallthrough/p1.cpp b/clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.fallthrough/p1.cpp
>   index 7a8d756b09fd..53b2ddd12885 100644
>   --- a/clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.fallthrough/p1.cpp
>   +++ b/clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.fallthrough/p1.cpp
>   @@ -33,8 +33,8 @@ void f(int n) {
>      case 6:
>        do {
>          [[fallthrough]];
>   -    } while (
>   -        false); // expected-error {{does not directly precede switch label}}
>   +    } while (false); // expected-error {{does not directly precede switch
>   +                     // label}}
>      case 7:
>        switch (n) {
>        case 0:
>
> Now I have undone the parts that changed this.  Formatting with the new version yields the same result as formatting with the program built from the main branch, whether with or without the `InsertBraces` option, except for this one line:
>
>   diff --git a/clang/test/SemaCXX/constant-expression-cxx11.cpp b/clang/test/SemaCXX/constant-expression-cxx11.cpp
>   index 4c6b6da9e415..4d063378f37c 100644
>   --- a/clang/test/SemaCXX/constant-expression-cxx11.cpp
>   +++ b/clang/test/SemaCXX/constant-expression-cxx11.cpp
>   @@ -1115,7 +1115,7 @@ static_assert(check(S(5), 11), "");
>    namespace PR14171 {
>    
>    struct X {
>   -  constexpr(operator int)() const { return 0; }
>   +  constexpr (operator int)() const { return 0; }
>    };
>    static_assert(X() == 0, "");

Thanks for running check-clang. Can you address the review comments <https://reviews.llvm.org/D121757#3407032> so that we can accept this patch? After you land it, I will add handling `switch` to InsertBraces and run check-clang again.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121757



More information about the cfe-commits mailing list