[-Wunsafe-buffer-usage] Add a Fixable for pointer pre-increment
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 std:span type, we generate fix-its that transform `e` to `(DRE = DRE.subspan(1)).data()`. For reference, `e` is in an UPC if `e` is - an argument of a function call (except the callee has [[unsafe_buffer_usage]] attribute), or - the operand of a cast-to-(Integer or Boolean) operation; or - the operand of a pointer subtraction operation; or - the operand of a pointer comparison operation; We may extend the definition of UPC by adding more cases later. Reviewed by: NoQ (Artem Dergachev) Differential revision: https://reviews.llvm.org/D144304
Loading
Please sign in to comment