[clang] [sema] Improve -Wsign-compare (PR #65684)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 6 10:47:38 PDT 2023


=?utf-8?q?FĂ©lix?= Cloutier <fcloutier at apple.com>
Message-ID:
In-Reply-To: <llvm/llvm-project/pull/65684/clang at github.com>


AaronBallman wrote:

> Thank you for this! Overall, I like the improvements.
> 
> I think the note and the fix-it are helpful. I'm more comfortable with the note than I am the fix-it, however, because the fix-it could result in a change in behavior of the code that takes accidentally working code and makes it incorrect: https://godbolt.org/z/cbxr5vE6x
> 
> CC @cjdb

Putting the fix-it on the *note* might alleviate some of my concern. I'm mostly worried about inattentive users getting burned. Some users will automatically apply all fix-its to source, but that doesn't happen for a fix-it associated with a note. We could also consider issuing two notes, one recommending a fix that just inserts the cast and the other recommending the `< 0` changes, so now the user has to think about which behavior they want.

https://github.com/llvm/llvm-project/pull/65684


More information about the cfe-commits mailing list