Improving unsafe array subscript warning reporting.
For array subscripts with a literal zero index, no warning will be emitted.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Analysis/UnsafeBufferUsage.cpp | ||
---|---|---|
192 | Isn't it the case you still want to cover zero indices but as a safe gadget to make sure fixits can be emitted? |
LGTM!
clang/lib/Analysis/UnsafeBufferUsage.cpp | ||
---|---|---|
192 | So according to the discussion in D140062 it actually *is* the right model to decide safety up front, and then maybe even have some duplication, because the safe gadget has to provide a lot more context in the matcher in order for us to emit any fix at all. So the fixable gadget wouldn't be "same thing but with different index". It'd be "a completely different thing with completely arbitrary index". |
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.