1
Fork 0

Add -Z llvm_module_flag

Allow adding values to the `!llvm.module.flags` metadata for a generated
module.  The syntax is

`-Z llvm_module_flag=<name>:<type>:<value>:<behavior>`

Currently only u32 values are supported but the type is required to be
specified for forward compatibility.  The `behavior` element must match
one of the named LLVM metadata behaviors.viors.

This flag is expected to be perma-unstable.
This commit is contained in:
Paul Menage 2023-10-09 02:22:14 -07:00
parent 2c1b65ee14
commit 2e6b57541d
5 changed files with 68 additions and 0 deletions

View file

@ -0,0 +1,7 @@
// Test for -Z llvm_module_flags
// compile-flags: -Z llvm_module_flag=foo:u32:123:error -Z llvm_module_flag=bar:u32:42:max
fn main() {}
// CHECK: !{i32 1, !"foo", i32 123}
// CHECK: !{i32 7, !"bar", i32 42}