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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to