[clang-tools-extra] [clang-tidy] Add check 'bugprone-assignment-in-selection-statement' (PR #180219)
Yanzuo Liu via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 8 04:23:25 PST 2026
=?utf-8?q?Balázs_Kéri?= <balazs.keri at ericsson.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/180219 at github.com>
zwuis wrote:
> ... but I'm not sure whether common patterns like `if ((x = dyn_cast<...>(...)) && ...)` should be considered as a FP. IMO they are safe and the extra parentheses signal that the assignment is intentional.
Not _extra_. The operator precedence of `=` is low. `a = b && c` is equivalent to `a = (b && c)`, not `(a = b) && c`.
https://github.com/llvm/llvm-project/pull/180219
More information about the cfe-commits
mailing list