Index: cfe/trunk/lib/Format/FormatTokenLexer.cpp =================================================================== --- cfe/trunk/lib/Format/FormatTokenLexer.cpp +++ cfe/trunk/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; 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; StateStack.push(LexerState::TOKEN_STASHED); } Index: cfe/trunk/unittests/Format/FormatTest.cpp =================================================================== --- cfe/trunk/unittests/Format/FormatTest.cpp +++ cfe/trunk/unittests/Format/FormatTest.cpp @@ -5501,6 +5501,18 @@ verifyFormat("< < < < < < < < < < < < < < < < < < < < < < < < < < < < < <"); } +TEST_F(FormatTest, BitshiftOperatorWidth) { + EXPECT_EQ("int a = 1 << 2; /* foo\n" + " bar */", + format("int a=1<<2; /* foo\n" + " bar */")); + + EXPECT_EQ("int b = 256 >> 1; /* foo\n" + " bar */", + format("int b =256>>1 ; /* foo\n" + " bar */")); +} + TEST_F(FormatTest, UnderstandsBinaryOperators) { verifyFormat("COMPARE(a, ==, b);"); verifyFormat("auto s = sizeof...(Ts) - 1;");