[PATCH] D61276: [clang-format] Fix bug in block comment reflow that joins * and /
Owen Pan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 29 13:05:49 PDT 2019
owenpan created this revision.
owenpan added reviewers: klimek, sammccall, MyDeveloperDay, djasper, krasimir.
owenpan added a project: clang.
Herald added a subscriber: cfe-commits.
This patch fixes PR41213 <https://bugs.llvm.org/show_bug.cgi?id=41213>.
Repository:
rC Clang
https://reviews.llvm.org/D61276
Files:
clang/lib/Format/BreakableToken.cpp
clang/unittests/Format/FormatTest.cpp
Index: clang/unittests/Format/FormatTest.cpp
===================================================================
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -11137,6 +11137,16 @@
FormatStyle Style = getLLVMStyle();
Style.ColumnLimit = 20;
+ // See PR41213
+ EXPECT_EQ("/*\n"
+ " * 456789012345678\n"
+ " * /x\n"
+ " */",
+ format("/*\n"
+ " *\t456789012345678 /x\n"
+ " */",
+ Style));
+
verifyFormat("int a; // the\n"
" // comment", Style);
EXPECT_EQ("int a; /* first line\n"
Index: clang/lib/Format/BreakableToken.cpp
===================================================================
--- clang/lib/Format/BreakableToken.cpp
+++ clang/lib/Format/BreakableToken.cpp
@@ -380,6 +380,8 @@
break;
if (!Content[i].empty() && i + 1 != e && Decoration.startswith(Content[i]))
continue;
+ if (Content[i].startswith("*\t"))
+ continue;
while (!Content[i].startswith(Decoration))
Decoration = Decoration.substr(0, Decoration.size() - 1);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61276.197153.patch
Type: text/x-patch
Size: 1153 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190429/0c516420/attachment.bin>
More information about the cfe-commits
mailing list