diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -119,7 +119,10 @@ // a statement. if (CurrentToken->Next && CurrentToken->Next->is(tok::greater) && Left->ParentBracket != tok::less && - isKeywordWithCondition(*Line.First)) + (isKeywordWithCondition(*Line.First) || + CurrentToken->getStartOfNonWhitespace() == + CurrentToken->Next->getStartOfNonWhitespace().getLocWithOffset( + -1))) return false; Left->MatchingParen = CurrentToken; CurrentToken->MatchingParen = Left; diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -7649,6 +7649,8 @@ verifyFormat("a = 1;", Style); verifyFormat("a >>= 1;", Style); + verifyFormat("test < a | b >> c;"); + verifyFormat("test> c;"); verifyFormat("test >> a >> b;"); verifyFormat("test << a >> b;");