[clang] [-Wunsafe-buffer-usage] Fix crashes in "Add check for custom printf/scanf functions #173096" (PR #174683)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 7 13:14:30 PST 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- clang/lib/Analysis/UnsafeBufferUsage.cpp clang/test/SemaCXX/warn-unsafe-buffer-usage-libc-functions.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Analysis/UnsafeBufferUsage.cpp b/clang/lib/Analysis/UnsafeBufferUsage.cpp
index 6b700355c..7c0eaa2e5 100644
--- a/clang/lib/Analysis/UnsafeBufferUsage.cpp
+++ b/clang/lib/Analysis/UnsafeBufferUsage.cpp
@@ -2257,8 +2257,7 @@ public:
}
// For printf-like functions:
if (AnyAttr && libc_func_matchers::hasUnsafeFormatOrSArg(
- Ctx, CE, UnsafeArg,
- FmtIdx, FmtArgIdx)) {
+ Ctx, CE, UnsafeArg, FmtIdx, FmtArgIdx)) {
Result.addNode(Tag, DynTypedNode::create(*CE));
Result.addNode(UnsafeStringTag, DynTypedNode::create(*UnsafeArg));
return true;
``````````
</details>
https://github.com/llvm/llvm-project/pull/174683
More information about the cfe-commits
mailing list