summaryrefslogtreecommitdiffstats
path: root/llvm/test/Linker/module-flags-3-a.ll
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-02-11 11:38:06 +0000
committerBill Wendling <isanbard@gmail.com>2012-02-11 11:38:06 +0000
commit66f02413efe426de35b298dd7aaa23f0a550707d (patch)
tree7f9fef071add611e46bacfe032224b12292ca4cf /llvm/test/Linker/module-flags-3-a.ll
parent981c6cf7b318132ea2ab123e5423b35d0d7a2e2f (diff)
downloadbcm5719-llvm-66f02413efe426de35b298dd7aaa23f0a550707d.tar.gz
bcm5719-llvm-66f02413efe426de35b298dd7aaa23f0a550707d.zip
[WIP] Initial code for module flags.
Module flags are key-value pairs associated with the module. They include a 'behavior' value, indicating how module flags react when mergine two files. Normally, it's just the union of the two module flags. But if two module flags have the same key, then the resulting flags are dictated by the behaviors. Allowable behaviors are: Error Emits an error if two values disagree. Warning Emits a warning if two values disagree. Require Emits an error when the specified value is not present or doesn't have the specified value. It is an error for two (or more) llvm.module.flags with the same ID to have the Require behavior but different values. There may be multiple Require flags per ID. Override Uses the specified value if the two values disagree. It is an error for two (or more) llvm.module.flags with the same ID to have the Override behavior but different values. llvm-svn: 150300
Diffstat (limited to 'llvm/test/Linker/module-flags-3-a.ll')
-rw-r--r--llvm/test/Linker/module-flags-3-a.ll14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/test/Linker/module-flags-3-a.ll b/llvm/test/Linker/module-flags-3-a.ll
new file mode 100644
index 00000000000..4233a0a7a5b
--- /dev/null
+++ b/llvm/test/Linker/module-flags-3-a.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-link %s %p/module-flags-3-b.ll -S -o - | sort | FileCheck %s
+
+; Test 'require' behavior.
+
+; CHECK: !0 = metadata !{i32 1, metadata !"foo", i32 37}
+; CHECK: !1 = metadata !{i32 3, metadata !"foo", metadata !2}
+; CHECK: !2 = metadata !{metadata !"bar", i32 42}
+; CHECK: !3 = metadata !{i32 1, metadata !"bar", i32 42}
+; CHECK: !llvm.module.flags = !{!0, !1, !3}
+
+!0 = metadata !{ i32 1, metadata !"foo", i32 37 }
+!1 = metadata !{ i32 1, metadata !"bar", i32 42 }
+
+!llvm.module.flags = !{ !0, !1 }
OpenPOWER on IntegriCloud