From 2e6b57541dc28cdd954b1ce2300b88ccc5c29d5c Mon Sep 17 00:00:00 2001 From: Paul Menage Date: Mon, 9 Oct 2023 02:22:14 -0700 Subject: 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=:::` 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. --- tests/codegen/llvm_module_flags.rs | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 tests/codegen/llvm_module_flags.rs (limited to 'tests/codegen') diff --git a/tests/codegen/llvm_module_flags.rs b/tests/codegen/llvm_module_flags.rs new file mode 100644 index 00000000000..acc035086de --- /dev/null +++ b/tests/codegen/llvm_module_flags.rs @@ -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} -- cgit 1.4.1-3-g733a5