[clang] [Sema] Diagnose use of if/else-if condition variable inside else-if/else branch(s) (PR #156436)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 2 08:07:19 PDT 2025
Sirraide wrote:
> One option would be simply ignore that - this warning applies to raw pointers only, not even integers. It can always be expanded later, if we can think of how.
Yeah, this is pretty much what I had in mind. We could hard-code some common standard-library types too (e.g. `std::unique_ptr`, `std::optional`); afaik there is precedent for doing this but I don’t recall if that was in the static analyser or not. Another option would be to add an attribute that you can use to indicate that it’s a bug if a type is used like this, but I don’t feel like this warrants an entire attribute...
> I wouldn't get my hopes up, not until [forgetting a return statement](https://godbolt.org/z/nKooafrGK) errors by default.
Tell me about it...
https://github.com/llvm/llvm-project/pull/156436
More information about the cfe-commits
mailing list