This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGf66d602c3f58: [clang-format] Fix wrong indentation after trailing requires clause. (authored by curdeius).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116183/new/ https://reviews.llvm.org/D116183 Files: clang/lib/Format/UnwrappedLineParser.cpp clang/unittests/Format/FormatTest.cpp Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -3556,6 +3556,11 @@ "struct b_struct {};\n" "} // namespace B\n", Style); + verifyFormat("template <int I> constexpr void foo requires(I == 42) {}\n" + "namespace ns {\n" + "void foo() {}\n" + "} // namespace ns\n", + Style); } TEST_F(FormatTest, NamespaceMacros) { Index: clang/lib/Format/UnwrappedLineParser.cpp =================================================================== --- clang/lib/Format/UnwrappedLineParser.cpp +++ clang/lib/Format/UnwrappedLineParser.cpp @@ -1439,7 +1439,7 @@ return; case tok::kw_requires: parseRequires(); - break; + return; case tok::kw_enum: // Ignore if this is part of "template <enum ...". if (Previous && Previous->is(tok::less)) {
Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -3556,6 +3556,11 @@ "struct b_struct {};\n" "} // namespace B\n", Style); + verifyFormat("template <int I> constexpr void foo requires(I == 42) {}\n" + "namespace ns {\n" + "void foo() {}\n" + "} // namespace ns\n", + Style); } TEST_F(FormatTest, NamespaceMacros) { Index: clang/lib/Format/UnwrappedLineParser.cpp =================================================================== --- clang/lib/Format/UnwrappedLineParser.cpp +++ clang/lib/Format/UnwrappedLineParser.cpp @@ -1439,7 +1439,7 @@ return; case tok::kw_requires: parseRequires(); - break; + return; case tok::kw_enum: // Ignore if this is part of "template <enum ...". if (Previous && Previous->is(tok::less)) {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits