diff options
author | Krasimir Georgiev <krasimir@google.com> | 2017-08-23 15:16:47 +0000 |
---|---|---|
committer | Krasimir Georgiev <krasimir@google.com> | 2017-08-23 15:16:47 +0000 |
commit | 7f7c3dc0aa3f8bbca09949d1860120aade2f5b31 (patch) | |
tree | bbcf2ba240d61830b8a098030a12357d1121cc55 /clang/unittests/Format/FormatTestComments.cpp | |
parent | 9f11c0bddfb04bb6697db065a48771dc3af03878 (diff) | |
download | bcm5719-llvm-7f7c3dc0aa3f8bbca09949d1860120aade2f5b31.tar.gz bcm5719-llvm-7f7c3dc0aa3f8bbca09949d1860120aade2f5b31.zip |
[clang-format] Emit absolute splits before lines for comments
Summary:
This patch makes the splits emitted for the beginning of comment lines during
reformatting absolute. Previously, they were relative to the start of the
non-whitespace content of the line, which messes up further TailOffset
calculations in breakProtrudingToken. This fixes an assertion failure reported
in bug 34236: https://bugs.llvm.org/show_bug.cgi?id=34236.
Reviewers: djasper
Reviewed By: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D36956
llvm-svn: 311559
Diffstat (limited to 'clang/unittests/Format/FormatTestComments.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTestComments.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestComments.cpp b/clang/unittests/Format/FormatTestComments.cpp index 79dc003ae85..70fa965adee 100644 --- a/clang/unittests/Format/FormatTestComments.cpp +++ b/clang/unittests/Format/FormatTestComments.cpp @@ -2803,6 +2803,23 @@ TEST_F(FormatTestComments, NonTrailingBlockComments) { " A = B;", getLLVMStyleWithColumns(40))); } + +TEST_F(FormatTestComments, NoCrush_Bug34236) { + // This is a test case from a crasher reported in: + // https://bugs.llvm.org/show_bug.cgi?id=34236 + EXPECT_EQ( + R"( +/* */ /* + * a + * b c + * d*/)", + format( + R"( +/* */ /* + * a b + * c d*/)", + getLLVMStyleWithColumns(80))); +} } // end namespace } // end namespace format } // end namespace clang |