[PATCH] D37007: [clang-format] Break non-trailing block comments
Krasimir Georgiev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 22 07:41:10 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL311457: [clang-format] Break non-trailing block comments (authored by krasimir).
Repository:
rL LLVM
https://reviews.llvm.org/D37007
Files:
cfe/trunk/lib/Format/ContinuationIndenter.cpp
cfe/trunk/unittests/Format/FormatTestComments.cpp
Index: cfe/trunk/lib/Format/ContinuationIndenter.cpp
===================================================================
--- cfe/trunk/lib/Format/ContinuationIndenter.cpp
+++ cfe/trunk/lib/Format/ContinuationIndenter.cpp
@@ -1282,7 +1282,7 @@
return 0;
}
} else if (Current.is(TT_BlockComment)) {
- if (!Current.isTrailingComment() || !Style.ReflowComments ||
+ if (!Style.ReflowComments ||
// If a comment token switches formatting, like
// /* clang-format on */, we don't want to break it further,
// but we may still want to adjust its indentation.
Index: cfe/trunk/unittests/Format/FormatTestComments.cpp
===================================================================
--- cfe/trunk/unittests/Format/FormatTestComments.cpp
+++ cfe/trunk/unittests/Format/FormatTestComments.cpp
@@ -2780,6 +2780,22 @@
"* long */",
getLLVMStyleWithColumns(20)));
}
+
+TEST_F(FormatTestComments, NonTrailingBlockComments) {
+ verifyFormat("const /** comment comment */ A = B;",
+ getLLVMStyleWithColumns(40));
+
+ verifyFormat("const /** comment comment comment */ A =\n"
+ " B;",
+ getLLVMStyleWithColumns(40));
+
+ EXPECT_EQ("const /** comment comment comment\n"
+ " comment */\n"
+ " A = B;",
+ format("const /** comment comment comment comment */\n"
+ " A = B;",
+ getLLVMStyleWithColumns(40)));
+}
} // end namespace
} // end namespace format
} // end namespace clang
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37007.112174.patch
Type: text/x-patch
Size: 1584 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170822/ef717d08/attachment.bin>
More information about the cfe-commits
mailing list