[clang] [Sema] Diagnose use of if/else-if condition variable inside else-if/else branch(s) (PR #156436)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 2 09:58:51 PDT 2025
erichkeane wrote:
> @Alcaro
>
> > I agree the worst case would be bad; if I'm reading things correctly, it'd be quadratic for things like
>
> Any specific code changes you want to suggest?
I suggested something using the `Scope` type above: Instead of a visitor, use the scope to figure out when we're in the 'else' block, then do the diagnostic on the init-variable there. We might need to store a slight more bit on `Scope`, but it should be much less overhead because of it.
https://github.com/llvm/llvm-project/pull/156436
More information about the cfe-commits
mailing list