diff options
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 5 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 159e60bfe15..634dbe97084 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -855,6 +855,11 @@ void UnwrappedLineParser::parseStructuralElement() { case tok::l_paren: parseParens(); break; + case tok::kw_operator: + nextToken(); + if (FormatTok->isBinaryOperator()) + nextToken(); + break; case tok::caret: nextToken(); if (FormatTok->Tok.isAnyIdentifier() || diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 6a265f3dd15..ff9d2d473ff 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -5327,6 +5327,8 @@ TEST_F(FormatTest, UnderstandsOverloadedOperators) { verifyGoogleFormat("operator ::A();"); verifyFormat("using A::operator+;"); + verifyFormat("inline A operator^(const A &lhs, const A &rhs) {}\n" + "int i;"); } TEST_F(FormatTest, UnderstandsFunctionRefQualification) { |

