[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 06:46:59 PDT 2025
https://github.com/erichkeane commented:
I also have done this a ton, but it is something we need to leave legal, as it IS a pattern folks actually use intentionally. So making this an error isn't something we can really do.
Doing this as a visitor is, IMO, not the right solution here. We can actually do this via https://clang.llvm.org/doxygen/classclang_1_1Scope.html I think instead? I wonder if anyone else has better ideas, but a visitor on every variable reference inside of an else is not acceptable.
https://github.com/llvm/llvm-project/pull/156436
More information about the cfe-commits
mailing list