Files
swift-mirror/test/IRGen/Inputs/sensitive.h
Erik Eckstein 1b1d5ed020 IRGen: support the @sensitive attribute
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.
2024-04-09 12:01:11 +02:00

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);