https://bugs.llvm.org/show_bug.cgi?id=46157
class A; void foo(A (*)(const A&, const A&), int); A operator+(const A&, const A&); void bar() { return foo(operator+, -42); }
is incorrect formatted putting a space between the - and the 42
return foo(operator+, - 42);
This revision tries to refine the annotating of the OverloadOperator to only mark the comma as an operator if its immediately after the operator keyword and to not mark the closing '(' as an TT_OverloadedOperatorLParen unless its actually a (
This code was assuming the usage of operator too much I suspect and not considering its use as a function ptr.
Probably a fairly rare corner case.
Shouldn't you check CurrentToken for not being null after a call to consumeToken?? It may happen if operator is at the end of input (even if it's a degenerated case).