diff options
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r-- | lib/Format/Format.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index ebb49498da..7085aaf8b7 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -696,16 +696,20 @@ private: return false; if (Left.is(tok::less) || Right.is(tok::greater) || Right.is(tok::less)) return false; + if (Right.is(tok::amp) || Right.is(tok::star)) + return Left.isLiteral() || + (Left.isNot(tok::star) && Left.isNot(tok::amp) && + !Style.PointerAndReferenceBindToType); if (Left.is(tok::amp) || Left.is(tok::star)) return Right.isLiteral() || Style.PointerAndReferenceBindToType; if (Right.is(tok::star) && Left.is(tok::l_paren)) return false; - if (Right.is(tok::amp) || Right.is(tok::star)) - return Left.isLiteral() || !Style.PointerAndReferenceBindToType; if (Left.is(tok::l_square) || Right.is(tok::l_square) || Right.is(tok::r_square)) return false; - if (Left.is(tok::coloncolon) || Right.is(tok::coloncolon)) + if (Left.is(tok::coloncolon) || + (Right.is(tok::coloncolon) && + (Left.is(tok::identifier) || Left.is(tok::greater)))) return false; if (Left.is(tok::period) || Right.is(tok::period)) return false; |