================
@@ -125,11 +125,38 @@ void SignedCharMisuseCheck::registerMatchers(MatchFinder 
*Finder) {
           .bind("arraySubscript");
 
   Finder->addMatcher(STDArraySubscript, this);
+
+  // Catch signed char values passed to a <cctype>/<ctype.h> classification
+  // or conversion function; any value other than EOF or one representable
+  // as unsigned char is undefined behavior. Unlike the matchers above, this
+  // matches the uncast argument directly instead of going through
+  // charCastExpression(), because hasArgument() strips implicit casts off
+  // the argument before matching it.
+  const auto IntTypedef = qualType(hasDeclaration(typedefDecl(
+      hasAnyName(utils::options::parseStringList(CharTypedefsToIgnoreList)))));
+  const auto CctypeFunctionArgument =
+      callExpr(
+          callee(functionDecl(
+              hasAnyName("isalnum", "std::isalnum", "isalpha", "std::isalpha",
+                         "isblank", "std::isblank", "iscntrl", "std::iscntrl",
----------------
zeyi2 wrote:

This currently would match unrelated functions such as `custom::isalpha` and 
`Classifier::toupper`. Please move the names into a static constexpr 
StringRef[] and restrict the matcher to global or std declarations (you can use 
`isInStdNamespace()` for this).

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