clang-format: Fix assert triggering on carriage returns.

llvm-svn: 228288
This commit is contained in:
Daniel Jasper 2015-02-05 11:05:31 +00:00
parent cb8c3d789e
commit 30029c6b58
2 changed files with 7 additions and 0 deletions

View File

@ -884,6 +884,9 @@ private:
Column = 0;
break;
case '\r':
FormatTok->LastNewlineOffset = WhitespaceLength + i + 1;
Column = 0;
break;
case '\f':
case '\v':
Column = 0;

View File

@ -2495,6 +2495,10 @@ TEST_F(FormatTest, DoesntRemoveUnknownTokens) {
"\\na : b);",
format("const char * c = STRINGIFY(\n"
"\\na : b);"));
verifyFormat("a\r\\");
verifyFormat("a\v\\");
verifyFormat("a\f\\");
}
TEST_F(FormatTest, IndentsPPDirectiveInReducedSpace) {