Index: clang/lib/Format/BreakableToken.cpp =================================================================== --- clang/lib/Format/BreakableToken.cpp +++ clang/lib/Format/BreakableToken.cpp @@ -41,8 +41,8 @@ static StringRef getLineCommentIndentPrefix(StringRef Comment, const FormatStyle &Style) { - static const char *const KnownCStylePrefixes[] = {"///<", "//!<", "///", "//", - "//!"}; + static const char *const KnownCStylePrefixes[] = { + "///<", "//!<", "///", "//", "//!", "//:", "//=", "//~"}; static const char *const KnownTextProtoPrefixes[] = {"//", "#", "##", "###", "####"}; ArrayRef KnownPrefixes(KnownCStylePrefixes); Index: clang/unittests/Format/FormatTestComments.cpp =================================================================== --- clang/unittests/Format/FormatTestComments.cpp +++ clang/unittests/Format/FormatTestComments.cpp @@ -702,6 +702,22 @@ " // long 1 2 3 4 5 6\n" "}", getLLVMStyleWithColumns(20))); + + EXPECT_EQ("//: A comment that\n" + "//: doesn't fit on\n" + "//: one line", + format("//: A comment that doesn't fit on one line", + getLLVMStyleWithColumns(20))); + EXPECT_EQ("//= A comment that\n" + "//= doesn't fit on\n" + "//= one line", + format("//= A comment that doesn't fit on one line", + getLLVMStyleWithColumns(20))); + EXPECT_EQ("//~ A comment that\n" + "//~ doesn't fit on\n" + "//~ one line", + format("//~ A comment that doesn't fit on one line", + getLLVMStyleWithColumns(20))); } TEST_F(FormatTestComments, PreservesHangingIndentInCxxComments) {