[PATCH] D132131: [clang-format] Adds a formatter for aligning trailing comments over empty lines

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 12 09:40:17 PDT 2022


MyDeveloperDay added inline comments.


================
Comment at: clang/include/clang/Format/Format.h:406
+    /// Specifies the way to align trailing comments
+    TrailingCommentsAlignmentKinds Kind;
+    /// How many empty lines to apply alignment
----------------
Kind? doesn't feel like the right word


================
Comment at: clang/include/clang/Format/Format.h:428-433
+    bool operator==(const TrailingCommentsAlignmentStyle &R) const {
+      return Kind == R.Kind && OverEmptyLines == R.OverEmptyLines;
+    }
+    bool operator!=(const TrailingCommentsAlignmentStyle &R) const {
+      return !(*this == R);
+    }
----------------
yusuke-kadowaki wrote:
> > I don't understand the need for state as a struct could have multiple options (as enums) each enum should have a state that means "Leave"
> 
> @MyDeveloperDay 
> Without having state, how can this be implemented?
bool Enabled  =  (Kind != FormatStyle::TCAS_Leave)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132131/new/

https://reviews.llvm.org/D132131



More information about the cfe-commits mailing list