diff options
| -rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 2 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index dd1c6819e28..fdad75917c6 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -918,6 +918,8 @@ private: if (NextToken->is(tok::l_square) && NextToken->Type != TT_LambdaLSquare) return TT_PointerOrReference; + if (NextToken->is(tok::kw_operator)) + return TT_PointerOrReference; if (PrevToken->is(tok::r_paren) && PrevToken->MatchingParen && PrevToken->MatchingParen->Previous && diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 13954fa6f86..968e13b3feb 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -4844,6 +4844,8 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) { // FIXME: Is there a way to make this work? // verifyIndependentOfContext("MACRO(A *a);"); + verifyFormat("DatumHandle const *operator->() const { return input_; }"); + EXPECT_EQ("#define OP(x) \\\n" " ostream &operator<<(ostream &s, const A &a) { \\\n" " return s << a.DebugString(); \\\n" |

