forked from OSchip/llvm-project
[clang-format] Treat && followed by noexcept operator as a binary operator inside template arguments
Fixes https://github.com/llvm/llvm-project/issues/44544. Reviewed By: curdeius, MyDeveloperDay Differential Revision: https://reviews.llvm.org/D120445
This commit is contained in:
parent
44adca60d4
commit
24d4f601aa
|
@ -2089,6 +2089,10 @@ private:
|
|||
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() ||
|
||||
|
|
|
@ -9512,6 +9512,8 @@ TEST_F(FormatTest, UnderstandsTemplateParameters) {
|
|||
verifyFormat("f(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
|
||||
" .template operator()<A>());",
|
||||
getLLVMStyleWithColumns(35));
|
||||
verifyFormat("bool_constant<a && noexcept(f())>");
|
||||
verifyFormat("bool_constant<a || noexcept(f())>");
|
||||
|
||||
// Not template parameters.
|
||||
verifyFormat("return a < b && c > d;");
|
||||
|
|
Loading…
Reference in New Issue