penagos updated this revision to Diff 411272. penagos added a comment. Rebase to trigger CI.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D120445/new/ https://reviews.llvm.org/D120445 Files: clang/lib/Format/TokenAnnotator.cpp clang/unittests/Format/FormatTest.cpp Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -9512,6 +9512,7 @@ verifyFormat("f(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" " .template operator()<A>());", getLLVMStyleWithColumns(35)); + verifyFormat("bool_constant<a && noexcept(f())>"); // Not template parameters. verifyFormat("return a < b && c > d;"); Index: clang/lib/Format/TokenAnnotator.cpp =================================================================== --- clang/lib/Format/TokenAnnotator.cpp +++ clang/lib/Format/TokenAnnotator.cpp @@ -2066,6 +2066,10 @@ return TT_UnaryOperator; const FormatToken *NextToken = Tok.getNextNonComment(); + + if (InTemplateArgument && NextToken && NextToken->is(tok::kw_noexcept)) + return TT_BinaryOperator; + if (!NextToken || NextToken->isOneOf(tok::arrow, tok::equal, tok::kw_noexcept) || NextToken->canBePointerOrReferenceQualifier() ||
Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -9512,6 +9512,7 @@ verifyFormat("f(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" " .template operator()<A>());", getLLVMStyleWithColumns(35)); + verifyFormat("bool_constant<a && noexcept(f())>"); // Not template parameters. verifyFormat("return a < b && c > d;"); Index: clang/lib/Format/TokenAnnotator.cpp =================================================================== --- clang/lib/Format/TokenAnnotator.cpp +++ clang/lib/Format/TokenAnnotator.cpp @@ -2066,6 +2066,10 @@ return TT_UnaryOperator; const FormatToken *NextToken = Tok.getNextNonComment(); + + if (InTemplateArgument && NextToken && NextToken->is(tok::kw_noexcept)) + return TT_BinaryOperator; + if (!NextToken || NextToken->isOneOf(tok::arrow, tok::equal, tok::kw_noexcept) || NextToken->canBePointerOrReferenceQualifier() ||
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits