diff options
| author | Daniel Jasper <djasper@google.com> | 2013-10-30 07:36:40 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2013-10-30 07:36:40 +0000 |
| commit | 580da276161ee8b2aa7bc6bd4631cd8261fb9bfb (patch) | |
| tree | 9bd4088f798013e14b8fc65095762ecd7dc387cf | |
| parent | 3bd686d49362d88abedfef45d9f02c2d016cf601 (diff) | |
| download | bcm5719-llvm-580da276161ee8b2aa7bc6bd4631cd8261fb9bfb.tar.gz bcm5719-llvm-580da276161ee8b2aa7bc6bd4631cd8261fb9bfb.zip | |
clang-format: fix for \r\r\n produced in multiline block comments
Patch by Christopher Olsen. Thank you!
llvm-svn: 193678
| -rw-r--r-- | clang/lib/Format/BreakableToken.cpp | 3 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 11 |
2 files changed, 13 insertions, 1 deletions
diff --git a/clang/lib/Format/BreakableToken.cpp b/clang/lib/Format/BreakableToken.cpp index cbc50f566a7..97475780f4e 100644 --- a/clang/lib/Format/BreakableToken.cpp +++ b/clang/lib/Format/BreakableToken.cpp @@ -25,13 +25,14 @@ namespace clang { namespace format { -static const char *const Blanks = " \t\v\f"; +static const char *const Blanks = " \t\v\f\r"; static bool IsBlank(char C) { switch (C) { case ' ': case '\t': case '\v': case '\f': + case '\r': return true; default: return false; diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 991763cdf7f..2f6e06ff02d 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -6984,6 +6984,17 @@ TEST_F(FormatTest, SupportsCRLF) { " b; \\\r\n" " c; d; \r\n", getGoogleStyle())); + + EXPECT_EQ("/*\r\n" + "multi line block comments\r\n" + "should not introduce\r\n" + "an extra carriage return\r\n" + "*/\r\n", + format("/*\r\n" + "multi line block comments\r\n" + "should not introduce\r\n" + "an extra carriage return\r\n" + "*/\r\n")); } TEST_F(FormatTest, MunchSemicolonAfterBlocks) { |

