1
Fork 0

Apply noundef attribute to &T, &mut T, Box<T>, bool

This doesn't handle `char` because it's a bit awkward to distinguish it
from u32 at this point in codegen.

Note that for some types (like `&Struct` and `&mut Struct`),
we already apply `dereferenceable`, which implies `noundef`,
so the IR does not change.
This commit is contained in:
Erik Desjardins 2022-02-05 01:00:37 -05:00
parent 71226d717a
commit 8cb0b6ca5b
10 changed files with 56 additions and 22 deletions

View file

@ -82,6 +82,7 @@ enum LLVMRustAttribute {
StackProtectReq = 30,
StackProtectStrong = 31,
StackProtect = 32,
NoUndef = 33,
};
typedef struct OpaqueRustString *RustStringRef;

View file

@ -224,6 +224,8 @@ static Attribute::AttrKind fromRust(LLVMRustAttribute Kind) {
return Attribute::StackProtectStrong;
case StackProtect:
return Attribute::StackProtect;
case NoUndef:
return Attribute::NoUndef;
}
report_fatal_error("bad AttributeKind");
}