Before, constructs like:
using A::operator+;
caused a segfault. This fixes llvm.org/PR17050.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189749
91177308-0d34-0410-b5e6-
96231b3b80d8
Tok->Type = TT_BinaryOperator;
break;
case tok::kw_operator:
- while (CurrentToken && CurrentToken->isNot(tok::l_paren)) {
+ while (CurrentToken &&
+ !CurrentToken->isOneOf(tok::l_paren, tok::semi, tok::r_paren)) {
if (CurrentToken->isOneOf(tok::star, tok::amp))
CurrentToken->Type = TT_PointerOrReference;
consumeToken();
- if (CurrentToken->Previous->Type == TT_BinaryOperator)
+ if (CurrentToken && CurrentToken->Previous->Type == TT_BinaryOperator)
CurrentToken->Previous->Type = TT_OverloadedOperator;
}
if (CurrentToken) {
verifyGoogleFormat("operator void*();");
verifyGoogleFormat("operator SomeType<SomeType<int>>();");
+
+ verifyFormat("using A::operator+;");
}
TEST_F(FormatTest, UnderstandsNewAndDelete) {