[PATCH] D132131: [clang-format] Adds a formatter for aligning trailing comments over empty lines
Yusuke Kadowaki via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 1 09:07:52 PDT 2022
yusuke-kadowaki marked an inline comment as done.
yusuke-kadowaki added inline comments.
================
Comment at: clang/include/clang/Format/Format.h:141
- /// Alignment options.
- ///
- /// They can also be read as a whole for compatibility. The choices are:
+ /// Alignment styles of ``AlignConsecutiveStyle`` are:
/// - None
----------------
HazardyKnusperkeks wrote:
> That I wouldn't change.
reverted
================
Comment at: clang/include/clang/Format/Format.h:154
/// \code
/// AlignConsecutiveMacros: AcrossEmptyLines
///
----------------
HazardyKnusperkeks wrote:
> The change/addition has to be here, since here it directly states `AlignConsecutiveMacros`.
What are you meaning to say here? I thought saying `AlignConsecutiveStyle` is used for multiple options is what we are trying to do.
Should we say something like,
> Here AlignConsecutiveMacros is used as an example, but in practice AlignConsecutiveStyle is also used with other options.
in this place?
================
Comment at: clang/unittests/Format/FormatTestComments.cpp:2863
+ FormatStyle Style = getLLVMStyle();
+ Style.AlignConsecutiveTrailingComments.AcrossEmptyLines = true;
+ verifyFormat("#include \"a.h\" // simple\n"
----------------
HazardyKnusperkeks wrote:
> yusuke-kadowaki wrote:
> > HazardyKnusperkeks wrote:
> > > Interesting would be a comment which is split, do we continue to align, or not?
> > Could you give me a specific example?
> Something like
> ```
> int foo = 2323234; // Comment
> int bar = 52323; // This is a very long comment, ...
> // which is wrapped around.
>
> int x = 2; // Is this still aligned?
> ```
> You may need to make the comment longer or reduce the column limit, as often used for testing the wrapping behavior.
Added that case with some column limits. I think it's working as expected. What do you think?
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