[PATCH] D149562: [clang-format] Stop comment disrupting indentation of Verilog ports
Owen Pan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 11 01:07:38 PDT 2023
owenpan added a comment.
In D149562#4332188 <https://reviews.llvm.org/D149562#4332188>, @sstwcw wrote:
>> IMO a trailing comment (empty or not) belongs to the code before it.
>
> There is only a parenthesis before it. It doesn't usually need a comment. It is like in 5a61139. One doesn't tend to comment a single brace.
I agree if the brace doesn't start a block, but clang-format sometimes got it wrong and misannotates a block as a braced list. (See https://github.com/llvm/llvm-project/issues/33891 for an example.)
>> A comment about the code below it should start on a new line.
>
> In this special case, the comment would be indented to the same column as the next line, so it should be clear it is for the next line. Like the case forbraced initializer lists, the first field will be on the same line as the brace if there isn't a comment, so the first comment is also on the same line as the brace when there is one.
>
> foo foo{// first field
> a,
> // second field
> b};
I'll go along with other reviewers on this one.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149562/new/
https://reviews.llvm.org/D149562
More information about the cfe-commits
mailing list