Before, the actual operator of an overloaded operator declaration was
handled as a binary operator an thus, clang-format could not find valid
formattings for many examples, e.g.:
template <typename
AAAAAAA, typename
BBBBBBB>
AAAAAAA operator/(const
AAAAAAA &a,
BBBBBBB &b);
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181585
91177308-0d34-0410-b5e6-
96231b3b80d8
CurrentToken->Type = TT_PointerOrReference;
consumeToken();
}
- if (CurrentToken)
+ if (CurrentToken) {
CurrentToken->Type = TT_OverloadedOperatorLParen;
+ if (CurrentToken->Parent->Type == TT_BinaryOperator)
+ CurrentToken->Parent->Type = TT_OverloadedOperator;
+ }
break;
case tok::question:
parseConditional();
TT_ObjCMethodSpecifier,
TT_ObjCProperty,
TT_ObjCSelectorName,
+ TT_OverloadedOperator,
TT_OverloadedOperatorLParen,
TT_PointerOrReference,
TT_PureVirtualSpecifier,
verifyFormat("void *operator new[](std::size_t size);");
verifyFormat("void operator delete(void *ptr);");
verifyFormat("void operator delete[](void *ptr);");
+ verifyFormat("template <typename AAAAAAA, typename BBBBBBB>\n"
+ "AAAAAAA operator/(const AAAAAAA &a, BBBBBBB &b);");
verifyFormat(
"ostream &operator<<(ostream &OutputStream,\n"