For a pointer type expression e of the form ++DRE, if e is under an Unspecified Pointer Context (UPC) and DRE is suppose to be transformed to have span type,
we generate fix-its that transform e to (DRE = DRE.subspan(1)).data().
For reference, the UPC is currently defined as
- 1. an argument of a function call (except the callee has [[unsafe_buffer_usage]] attribute), or
- 2. the operand of a cast-to-(Integer or Boolean) operation; or
- 3. the operand of a pointer subtraction operation; or
- 4. the operand of a pointer comparison operation;
We may extend the definition of UPC by adding more cases later.
Oh interesting, so hasOperatorName wasn't sufficient, because operators ++ and ++ have the same "name"?
Yeah, sounds like a universally useful matcher, we should commit it to ASTMatchers.h for everybody to use.