diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h --- a/clang/include/clang/Format/Format.h +++ b/clang/include/clang/Format/Format.h @@ -2007,6 +2007,20 @@ /// \version 3.4 bool Cpp11BracedListStyle; + /// If ``true``, when a block comment is reflowed, add a ``* `` to the + /// beginning of the continuation line. + /// \code + /// false: + /// /* blah blah blah blah blah blah blah blah blah blah blah blah blah + /// blah blah blah blah blah blah blah blah */ + /// + /// true: + /// /* blah blah blah blah blah blah blah blah blah blah blah blah blah + /// * blah blah blah blah blah blah blah blah */ + /// \endcode + /// \version 17 + bool DecorateReflowedComments; + /// This option is **deprecated**. See ``DeriveLF`` and ``DeriveCRLF`` of /// ``LineEnding``. /// \version 10 diff --git a/clang/lib/Format/BreakableToken.cpp b/clang/lib/Format/BreakableToken.cpp --- a/clang/lib/Format/BreakableToken.cpp +++ b/clang/lib/Format/BreakableToken.cpp @@ -403,7 +403,7 @@ } Decoration = "* "; - if (Lines.size() == 1 && !FirstInLine) { + if ((Lines.size() == 1 && !FirstInLine) || !Style.DecorateReflowedComments) { // Comments for which FirstInLine is false can start on arbitrary column, // and available horizontal space can be too small to align consecutive // lines with the first one. diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -901,6 +901,7 @@ Style.ConstructorInitializerIndentWidth); IO.mapOptional("ContinuationIndentWidth", Style.ContinuationIndentWidth); IO.mapOptional("Cpp11BracedListStyle", Style.Cpp11BracedListStyle); + IO.mapOptional("DecorateReflowedComments", Style.DecorateReflowedComments); IO.mapOptional("DerivePointerAlignment", Style.DerivePointerAlignment); IO.mapOptional("DisableFormat", Style.DisableFormat); IO.mapOptional("EmptyLineAfterAccessModifier",