================
@@ -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)) {
----------------
zeyi2 wrote:

This appears to regress existing behavior:

```cpp
int read(int *values) {
  constexpr signed char index = -1;
  return values[static_cast<unsigned int>(index)];
}
```

It would give a warning before: https://clang-tidy.godbolt.org/z/xWa9fT9sY

Could we preserve `getSubExpr()` evaluation for the existing matchers and 
handle the `cctype` argument separately?

https://github.com/llvm/llvm-project/pull/211403
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to