[clang] [Clang] Optimize -Wunsafe-buffer-usage. (PR #125492)
Ilya Biryukov via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 7 03:49:40 PST 2025
================
@@ -787,9 +933,9 @@ AST_MATCHER(FunctionDecl, isNormalPrintfFunc) {
// Then if the format string is a string literal, this matcher matches when at
// least one string argument is unsafe. If the format is not a string literal,
// this matcher matches when at least one pointer type argument is unsafe.
-AST_MATCHER_P(CallExpr, hasUnsafePrintfStringArg,
- clang::ast_matchers::internal::Matcher<Expr>,
- UnsafeStringArgMatcher) {
+static bool hasUnsafePrintfStringArg(const CallExpr &Node, ASTContext &Ctx,
+ MatchResult &Result,
+ const char *const Op) {
----------------
ilya-biryukov wrote:
NIT: use `llvm::StringRef` instead of `char*`, it's more idiomatic and more flexible.
https://github.com/llvm/llvm-project/pull/125492
More information about the cfe-commits
mailing list