[clang] [-Wunsafe-buffer-usage] Fixits for unsafe arguments of function pointer calls (PR #80358)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 13 15:36:51 PST 2024
================
@@ -282,8 +282,8 @@ isInUnspecifiedPointerContext(internal::Matcher<Stmt> InnerMatcher) {
// (i.e., computing the distance between two pointers); or ...
auto CallArgMatcher =
- callExpr(forEachArgumentWithParam(InnerMatcher,
- hasPointerType() /* array also decays to pointer type*/),
+ callExpr(forEachArgumentWithParamType(InnerMatcher,
+ isAnyPointer() /* array also decays to pointer type*/),
----------------
jkorous-apple wrote:
Removing `hasCanonicalType()` is intentional but not well communicated by the commit message - I'll fix that.
There's 2 different things going on and I probably could've separated this tiny change into two even-more-tiny changes.
1. Support for calls on function pointers - that's mostly the `forEachArgumentWithParam` -> `forEachArgumentWithParamType`.
2. Suport for const size arrays - that's removing the `hasCanonicalType()` to allow for array to pointer decay (which the comment in the snippet suggests we already expected).
https://github.com/llvm/llvm-project/pull/80358
More information about the cfe-commits
mailing list