diff options
| author | Alexander Kornienko <alexfh@google.com> | 2014-04-17 16:12:46 +0000 |
|---|---|---|
| committer | Alexander Kornienko <alexfh@google.com> | 2014-04-17 16:12:46 +0000 |
| commit | 67d9c8c87ef4451214211ae8bb44f84ec7713a4b (patch) | |
| tree | 67b2dde644078e6bb48465303e6b7f79e97afef3 /clang/unittests/Format/FormatTest.cpp | |
| parent | ed5aced64ef601411e400d8bb89e4dde4b7820a7 (diff) | |
| download | bcm5719-llvm-67d9c8c87ef4451214211ae8bb44f84ec7713a4b.tar.gz bcm5719-llvm-67d9c8c87ef4451214211ae8bb44f84ec7713a4b.zip | |
Fix alignment of trailing block comments.
Summary:
This patch ensures that the lines of the block comments retain relative
column offsets. In order to do this WhitespaceManager::Changes representing
continuation of block comments keep a pointer on the change representing the
whitespace change before the block comment, and a relative column offset to this
change, so that the correct column can be reconstructed at the end of alignment
process.
Fixes http://llvm.org/PR19325
Reviewers: djasper
Reviewed By: djasper
CC: cfe-commits, klimek
Differential Revision: http://reviews.llvm.org/D3408
llvm-svn: 206472
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index d3fbb02e5d4..4c74ed61aac 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -1013,6 +1013,30 @@ TEST_F(FormatTest, AlignsBlockComments) { format("int i; /* Comment with empty...\n" " *\n" " * line. */")); + EXPECT_EQ("int foobar = 0; /* comment */\n" + "int bar = 0; /* multiline\n" + " comment 1 */\n" + "int baz = 0; /* multiline\n" + " comment 2 */\n" + "int bzz = 0; /* multiline\n" + " comment 3 */", + format("int foobar = 0; /* comment */\n" + "int bar = 0; /* multiline\n" + " comment 1 */\n" + "int baz = 0; /* multiline\n" + " comment 2 */\n" + "int bzz = 0; /* multiline\n" + " comment 3 */")); + EXPECT_EQ("int foobar = 0; /* comment */\n" + "int bar = 0; /* multiline\n" + " comment */\n" + "int baz = 0; /* multiline\n" + "comment */", + format("int foobar = 0; /* comment */\n" + "int bar = 0; /* multiline\n" + "comment */\n" + "int baz = 0; /* multiline\n" + "comment */")); } TEST_F(FormatTest, CorrectlyHandlesLengthOfBlockComments) { |

