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.
This commit is contained in:
Erik Eckstein
2024-04-04 21:29:53 +02:00
parent ce33d47a4c
commit 1b1d5ed020
34 changed files with 570 additions and 81 deletions

View File

@@ -2832,6 +2832,13 @@ FUNCTION(ClearSensitive, swift_clearSensitive, C_CC, ClearSensitiveAvailability,
EFFECT(NoEffect),
UNKNOWN_MEMEFFECTS)
FUNCTION(MemsetS, memset_s, C_CC, AlwaysAvailable,
RETURNS(Int32Ty),
ARGS(PtrTy, SizeTy, Int32Ty, SizeTy),
ATTRS(NoUnwind),
EFFECT(NoEffect),
UNKNOWN_MEMEFFECTS)
#undef RETURNS
#undef ARGS
#undef ATTRS