[PATCH] D133942: Clang tidy utility to generate a fix hint for a subsequent expression to the existing one

Bartłomiej Cieślar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 17 10:13:36 PDT 2022


barcisz added a comment.

In D133942#3797449 <https://reviews.llvm.org/D133942#3797449>, @njames93 wrote:

> How does this handle pathological cases like the statement being the iteration-expression of a for loop, or a init-statement in an if/switch/range-for loop. The documentation looks like it tries to explain that, but it doesn't do a great job IMHO.

It doesn't really, it's mostly meant for cases where we know that the statement will be in the body and it's only added in the utils because it's needed for D133956 <https://reviews.llvm.org/D133956>, but I can just move it to inside the check if you believe that it won't be as useful for the general case. The reason I want to preserve the statement to which the comments relate to is because if I put the new statement/macro invocation right after the current statement then the formatted will move the comments to the new line with the new statement instead of keeping them in the same line as the current statement (and in case of macros I'm not sure if it will even move it to the next line at all)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133942



More information about the cfe-commits mailing list