[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 Aug 29 14:16:19 PDT 2022


MyDeveloperDay added inline comments.


================
Comment at: clang/docs/ClangFormatStyleOptions.rst:785
+  - Consecutive
+  - AcrossEmptyLines
+  - AcrossComments
----------------
may be AcrossEmptyLines should be a number (to mean the number of empty lines)


================
Comment at: clang/docs/ClangFormatStyleOptions.rst:794
+
+    AlignConsecutiveMacros: AcrossEmptyLines
+
----------------
Should this say `AlignedConsecutuveCommets`


================
Comment at: clang/docs/ClangFormatStyleOptions.rst:797
+    AlignConsecutiveMacros:
+      Enabled: true
+      AcrossEmptyLines: true
----------------
HazardyKnusperkeks wrote:
> MyDeveloperDay wrote:
> > why do we need Enabled?
> > 
> > isn't it just
> > 
> > ```
> > false:
> > AcrossEmptyLines: false
> > AcrossComments: false
> > 
> > true:
> > AcrossEmptyLines: true
> > AcrossComments: true
> > ```
> The struct is a bit older. And we need `Enabled`, one might wish to align only really consecutive comments, as the option right now does. (Same for macros, assignments, etc..)
I'm still not sure I understand, plus are those use cases you describe tested, I couldn't see that. 

If feels like what you are saying is that AlignConsecutiveStyle is used elsewhere and it has options that don't pertain to aligning comments? 

I couldn't tell if feel like this documentation is describing something other than AligningTrailingComments, if I'm confused users could be too? 


================
Comment at: clang/unittests/Format/FormatTestComments.cpp:2876
+               
+  verifyFormat("#include \"a.h\"      //\n"
+               "#include \"aa.h\"     //\n"
----------------
can we have real comments with different lengths?


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