[clang] [clang-format] Separate License text and include blocks (PR #77918)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 15 06:07:01 PST 2024


================
@@ -3853,46 +3853,51 @@ struct FormatStyle {
     /// Leave definition blocks as they are.
     SDS_Leave,
     /// Insert an empty line between definition blocks.
-    SDS_Always,
+    SDS_One,
+    /// Insert two empty lines between definition blocks.
+    SDS_Two,
     /// Remove any empty line between definition blocks.
     SDS_Never
   };
 
   /// Specifies the use of empty lines to separate definition blocks, including
-  /// classes, structs, enums, and functions.
+  /// license text, includes, classes, structs, enums, and functions.
----------------
mydeveloperday wrote:

I am concerned by this approach, the others items there are often lost of items but for license block its likely one.

This feels like it should be handled seperately, with a new Options (coded seperately)

NewLinesAfterLicense: 2
NewLinesAfterIncludes: 1

I'd think about the Includes completely seperately as we might want to consider NewLines between IncludeGroups too.

But for me I think shoehorning this feature over the top of the SDS setting is unclear, and frankly a little smelly.

https://github.com/llvm/llvm-project/pull/77918


More information about the cfe-commits mailing list