forked from OSchip/llvm-project
Fix formatting of overloaded assignment operators.
Before: SomeType &operator=(const SomeType & S); After: SomeType &operator=(const SomeType &S); llvm-svn: 179270
This commit is contained in:
parent
8c4c126653
commit
6e8f4edf2d
|
@ -563,7 +563,8 @@ private:
|
|||
};
|
||||
|
||||
void determineTokenType(AnnotatedToken &Current) {
|
||||
if (getPrecedence(Current) == prec::Assignment) {
|
||||
if (getPrecedence(Current) == prec::Assignment &&
|
||||
(!Current.Parent || Current.Parent->isNot(tok::kw_operator))) {
|
||||
Contexts.back().IsExpression = true;
|
||||
for (AnnotatedToken *Previous = Current.Parent;
|
||||
Previous && Previous->isNot(tok::comma);
|
||||
|
|
|
@ -2374,6 +2374,7 @@ TEST_F(FormatTest, UndestandsOverloadedOperators) {
|
|||
" const aaaaaaaaaaaaaaaaaaaaa &right) {\n"
|
||||
" return left.group < right.group;\n"
|
||||
"}");
|
||||
verifyFormat("SomeType &operator=(const SomeType &S);");
|
||||
|
||||
verifyGoogleFormat("operator void*();");
|
||||
verifyGoogleFormat("operator SomeType<SomeType<int>>();");
|
||||
|
|
Loading…
Reference in New Issue