[clang-tools-extra] [clang-tidy] Catch <cctype> function args in bugprone-signed-char-misuse (PR #211403)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 5 22:47:21 PDT 2026
================
@@ -138,8 +165,7 @@ void SignedCharMisuseCheck::check(const MatchFinder::MatchResult &Result) {
// The potential misinterpretation happens for negative values only.
Expr::EvalResult EVResult;
if (!SignedCastExpression->isValueDependent() &&
- SignedCastExpression->getSubExpr()->EvaluateAsInt(EVResult,
- *Result.Context)) {
+ SignedCastExpression->EvaluateAsInt(EVResult, *Result.Context)) {
----------------
cavdarahmet wrote:
Confirmed and fixed — thanks for catching this, it was a real regression. The shared `check()` path is now identical to `main` again (both `getSubExpr()->EvaluateAsInt()` calls restored); the cctype case binds a separate `cctypeArgument` node and is handled in an isolated early-return branch, exactly as you suggested. Your example is now a regression test, plus a constexpr-negative test for the new path.
https://github.com/llvm/llvm-project/pull/211403
More information about the cfe-commits
mailing list