[clang] [clang][analyzer] Add new option to specify functions `SecuritySyntaxChecker` warns about (PR #164184)
Balazs Benics via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 30 03:15:12 PDT 2025
================
@@ -839,79 +839,89 @@ def PaddingChecker : Checker<"Padding">,
let ParentPackage = InsecureAPI in {
-def SecuritySyntaxChecker : Checker<"SecuritySyntaxChecker">,
- HelpText<"Base of various security function related checkers">,
- Documentation<NotDocumented>,
- Hidden;
-
-def bcmp : Checker<"bcmp">,
- HelpText<"Warn on uses of the 'bcmp' function">,
- Dependencies<[SecuritySyntaxChecker]>,
- Documentation<HasDocumentation>;
-
-def bcopy : Checker<"bcopy">,
- HelpText<"Warn on uses of the 'bcopy' function">,
- Dependencies<[SecuritySyntaxChecker]>,
- Documentation<HasDocumentation>;
-
-def bzero : Checker<"bzero">,
- HelpText<"Warn on uses of the 'bzero' function">,
- Dependencies<[SecuritySyntaxChecker]>,
- Documentation<HasDocumentation>;
-
-def gets : Checker<"gets">,
- HelpText<"Warn on uses of the 'gets' function">,
- Dependencies<[SecuritySyntaxChecker]>,
- Documentation<HasDocumentation>;
-
-def getpw : Checker<"getpw">,
- HelpText<"Warn on uses of the 'getpw' function">,
- Dependencies<[SecuritySyntaxChecker]>,
- Documentation<HasDocumentation>;
-
-def mktemp : Checker<"mktemp">,
- HelpText<"Warn on uses of the 'mktemp' function">,
- Dependencies<[SecuritySyntaxChecker]>,
- Documentation<HasDocumentation>;
-
-def mkstemp : Checker<"mkstemp">,
- HelpText<"Warn when 'mkstemp' is passed fewer than 6 X's in the format "
- "string">,
- Dependencies<[SecuritySyntaxChecker]>,
- Documentation<HasDocumentation>;
+ def SecuritySyntaxChecker
+ : Checker<"SecuritySyntaxChecker">,
+ HelpText<"Base of various security function related checkers">,
+ CheckerOptions<[CmdLineOption<
+ String, "Warn",
+ "List of space-separated function name to be warned about. "
+ "Defaults to an empty list.",
+ "", InAlpha>]>,
+ Documentation<NotDocumented>,
+ Hidden;
+
+ def bcmp : Checker<"bcmp">,
+ HelpText<"Warn on uses of the 'bcmp' function">,
+ Dependencies<[SecuritySyntaxChecker]>,
+ Documentation<HasDocumentation>;
----------------
steakhal wrote:
Now that we have a more generic way of setting the list of checked functions, would this and the rest of the checkers be obsolete if one would add the `bcmp` to the BannedFunctions list?
What if we made this part of that default list?
https://github.com/llvm/llvm-project/pull/164184
More information about the cfe-commits
mailing list