[PATCH] D106431: [clang-tidy] Fix cppcoreguidelines-init-variables with enum judgement

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 22 07:58:47 PDT 2021


aaron.ballman added a comment.

In D106431#2896472 <https://reviews.llvm.org/D106431#2896472>, @whisperity wrote:

> In D106431#2896441 <https://reviews.llvm.org/D106431#2896441>, @aaron.ballman wrote:
>
>> However, I don't recall how clang-tidy interacts with fix-its on notes off the top of my head, so I'm making an assumption that clang-tidy's automatic fixit applying mode handles notes the same way as clang and we should double-check that assumption.
>
> I have one information from January that if you're viewing the diagnostic output as a sequence of `[warning, note, note, ...]` elements (so you "group by" warning), Clang-Tidy will apply the //first// fix (be it on the warning or the note) in the order of `diag()` calls. (There was a (never-upstreamed) check in which I had to abuse this fact.) This behaviour could've changed, though...
>
> In D106431#2896441 <https://reviews.llvm.org/D106431#2896441>, @aaron.ballman wrote:
>
>> Another way forward would be to not issue a fix-it for integers or enumerations.
>
> This might be the best course of action, and could be fixed in the same patch (this one)...

I think that's a reasonable way forward, though I don't insist on changing the integer behavior if others have strong opinions that it is correct. I do have strong opinions on fixing the enumeration behavior because that fix-it is wrong for C++ code.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106431



More information about the cfe-commits mailing list