diff options
author | MalavikaSamak <malavika2@apple.com> | 2023-04-07 15:11:05 -0700 |
---|---|---|
committer | MalavikaSamak <malavika2@apple.com> | 2023-04-07 15:32:19 -0700 |
commit | a046d187720137d944cece4aa4561f4bceb54e3c (patch) | |
tree | cdbd02bf43e4f633e8c3719bd7ae36364cc41bf5 /llvm/docs/CommandGuide/llvm-remarkutil.rst | |
parent | a7c2102d988b2ae2214f1483d2b4066955b4dc98 (diff) | |
download | llvm-a046d187720137d944cece4aa4561f4bceb54e3c.zip llvm-a046d187720137d944cece4aa4561f4bceb54e3c.tar.gz llvm-a046d187720137d944cece4aa4561f4bceb54e3c.tar.bz2 |
[-Wunsafe-buffer-usage] FixableGadget for handling stand alone pointers under UPC
This patch introduces UPCStandalonePointerGadget, a FixableGadget that emits fixits to
handle cases where a pointer identified as unsafe is simply referenced. An example of
such a case is when the pointer is input as an argument to a method call, where we can
not change the type of the argument. For cases where the strategy for the unsafe pointer is
to use std::span, the idea is to extract the underlying pointer by invoking the "data()"
method on the span instance.
For example, the gadget emits a fixit for S3, where S1, S2 are handled by other gadgets:
S1: int *ptr = new int[10];
S2: int val1 = ptr[k]; // Unsafe operation on ptr
S3: foo(ptr); // Some method that accepts raw pointer => FIXIT: foo(ptr.data());
Reviewed by: NoQ, ziqingluo-90, jkorous
Differential revision: https://reviews.llvm.org/D143676
Diffstat (limited to 'llvm/docs/CommandGuide/llvm-remarkutil.rst')
0 files changed, 0 insertions, 0 deletions