mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Call `swift_clearSensitive` after destroying or taking "sensitive" struct types. Also, support calling C-functions with "sensitive" parameters or return values. In SIL, sensitive types are address-only and so are sensitive parameters/return values. Though, (small) sensitive C-structs are passed directly to/from C-functions. We need re-abstract such parameter and return values for C-functions.
26 lines
629 B
C
26 lines
629 B
C
|
|
struct __attribute__((swift_attr("sensitive"))) SmallCStruct {
|
|
unsigned a;
|
|
unsigned b;
|
|
unsigned c;
|
|
};
|
|
|
|
struct __attribute__((swift_attr("sensitive"))) LargeCStruct {
|
|
unsigned a;
|
|
unsigned b;
|
|
unsigned c;
|
|
unsigned d;
|
|
unsigned e;
|
|
unsigned f;
|
|
unsigned g;
|
|
};
|
|
|
|
struct SmallCStruct getSmallStruct(int x);
|
|
struct LargeCStruct getLargeStruct(int x);
|
|
|
|
void printSmallStruct(int x, struct SmallCStruct s, int y);
|
|
struct SmallCStruct forwardSmallStruct(struct SmallCStruct s);
|
|
void printLargeStruct(int x, struct LargeCStruct s, int y);
|
|
struct LargeCStruct forwardLargeStruct(struct LargeCStruct s);
|
|
|