[PATCH] D138321: [-Wunsafe-buffer-usage] Ignore array subscript on literal zero
Gábor Horváth via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 18 15:05:48 PST 2022
xazax.hun added inline comments.
================
Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:219
+ arraySubscriptExpr(hasBase(ignoringParenImpCasts(hasPointerType())),
+ unless(hasIndex(integerLiteral(equals(0)))))
.bind("arraySubscr"));
----------------
Isn't it the case you still want to cover zero indices but as a safe gadget to make sure fixits can be emitted?
Having to add another gadget for this makes me think maybe categorizing the safety of gadgets upfront is not the right model.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D138321/new/
https://reviews.llvm.org/D138321
More information about the cfe-commits
mailing list