[clang] [clang-format] Separate License text and include blocks (PR #77918)
Björn Schäpers via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 19 11:47:37 PST 2024
================
@@ -2459,6 +2459,52 @@ struct FormatStyle {
/// \version 12
EmptyLineBeforeAccessModifierStyle EmptyLineBeforeAccessModifier;
+ /// \brief Number of lines after includes.
+ /// If set, determines the number of lines to insert after includes.
+ /// Limited by MaxEmptyLinesToKeep.
+ /// Example:
+ /// EmptyLinesAfterIncludes = 1
+ /// \code
+ /// #include <string>
+ /// #include <map>
+ ///
+ /// class Test {};
+ ///
+ /// \endcode
+ /// vs EmptyLinesAfterIncludes = 2
+ /// \code
+ /// #include <string>
+ /// #include <map>
+ ///
+ ///
+ /// class Test {};
+ /// \endcode
+ /// \version 1
+ std::optional<unsigned> EmptyLinesAfterIncludes;
+
+ /// \brief Number of empty lines after top level comment.
+ /// If set, determines the number of empty lines to insert/keep after the top
+ /// level comment. Limited by MaxEmptyLinesToKeep.
+ /// Example:
+ /// EmptyLinesAfterTopLevelComment = 1
+ /// \code
+ /// /* LICENSE TEXT */
+ ///
+ /// #include <string>
+ /// class Test {};
+ ///
+ /// \endcode
+ /// vs EmptyLinesAfterTopLevelComment = 2
+ /// \code
+ /// /* License Text */
+ ///
+ ///
+ /// #include <string>
+ /// class Test {};
+ /// \endcode
+ /// \version 1
+ std::optional<unsigned> EmptyLinesAfterTopLevelComment;
----------------
HazardyKnusperkeks wrote:
The name has to be improved.
```c++
// Top level comment in your definition
#include <foo>
// But this is also top level, or not?
```
https://github.com/llvm/llvm-project/pull/77918
More information about the cfe-commits
mailing list