llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-format Author: Fernando Tagawa (XDeme) <details> <summary>Changes</summary> Fixes llvm/llvm-project#<!-- -->63241 Doxygen commands can start with `@` or `\`. --- Full diff: https://github.com/llvm/llvm-project/pull/80381.diff 2 Files Affected: - (modified) clang/lib/Format/BreakableToken.cpp (+2-2) - (modified) clang/unittests/Format/FormatTestComments.cpp (+8) ``````````diff diff --git a/clang/lib/Format/BreakableToken.cpp b/clang/lib/Format/BreakableToken.cpp index 473908e8fee3b..75304908dc650 100644 --- a/clang/lib/Format/BreakableToken.cpp +++ b/clang/lib/Format/BreakableToken.cpp @@ -449,11 +449,11 @@ const FormatToken &BreakableComment::tokenAt(unsigned LineIndex) const { static bool mayReflowContent(StringRef Content) { Content = Content.trim(Blanks); - // Lines starting with '@' commonly have special meaning. + // Lines starting with '@' or '\' commonly have special meaning. // Lines starting with '-', '-#', '+' or '*' are bulleted/numbered lists. bool hasSpecialMeaningPrefix = false; for (StringRef Prefix : - {"@", "TODO", "FIXME", "XXX", "-# ", "- ", "+ ", "* "}) { + {"@", "\\", "TODO", "FIXME", "XXX", "-# ", "- ", "+ ", "* "}) { if (Content.starts_with(Prefix)) { hasSpecialMeaningPrefix = true; break; diff --git a/clang/unittests/Format/FormatTestComments.cpp b/clang/unittests/Format/FormatTestComments.cpp index c249f4d9333fd..0327937e4496a 100644 --- a/clang/unittests/Format/FormatTestComments.cpp +++ b/clang/unittests/Format/FormatTestComments.cpp @@ -1909,6 +1909,14 @@ TEST_F(FormatTestComments, ReflowsComments) { "// @param arg", getLLVMStyleWithColumns(20))); + // Don't reflow lines starting with '\'. + EXPECT_EQ("// long long long\n" + "// long\n" + "// \\param arg", + format("// long long long long\n" + "// \\param arg", + getLLVMStyleWithColumns(20))); + // Don't reflow lines starting with 'TODO'. EXPECT_EQ("// long long long\n" "// long\n" `````````` </details> https://github.com/llvm/llvm-project/pull/80381 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits