Index: lib/Format/FormatTokenLexer.cpp =================================================================== --- lib/Format/FormatTokenLexer.cpp +++ lib/Format/FormatTokenLexer.cpp @@ -525,10 +525,12 @@ } else if (FormatTok->Tok.is(tok::greatergreater)) { FormatTok->Tok.setKind(tok::greater); FormatTok->TokenText = FormatTok->TokenText.substr(0, 1); + Column += 1; StateStack.push(LexerState::TOKEN_STASHED); } else if (FormatTok->Tok.is(tok::lessless)) { FormatTok->Tok.setKind(tok::less); FormatTok->TokenText = FormatTok->TokenText.substr(0, 1); + Column += 1; StateStack.push(LexerState::TOKEN_STASHED); } Index: unittests/Format/FormatTest.cpp =================================================================== --- unittests/Format/FormatTest.cpp +++ unittests/Format/FormatTest.cpp @@ -11361,6 +11361,16 @@ "aaaallvm::outs()\n <<"); } +TEST_F(FormatTest, BitshiftOperatorWidth) { + std::string left = "int a = 1 << 2; /* foo\n" + " bar */"; + EXPECT_EQ(left, format(left)); + + std::string right = "int b = 256 >> 2; /* foo\n" + " bar */"; + EXPECT_EQ(right, format(right)); +} + TEST_F(FormatTest, HandleUnbalancedImplicitBracesAcrossPPBranches) { std::string code = "#if A\n" "#if B\n"