aboutsummaryrefslogtreecommitdiff
path: root/test/TableGen
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2010-01-05 19:11:42 +0000
committerDavid Greene <greened@obbligato.org>2010-01-05 19:11:42 +0000
commit6786d5e18387465d6106eaef0b7923526ef0bc10 (patch)
tree3665a60a078ae910aeff79fc75a4c8eb9f918781 /test/TableGen
parent5f7775c85e60aa659ac76c4b18f7a1f6494f23e2 (diff)
Add an !eq() operator to TableGen. It operates on strings only.
Use !cast<string>() to compare other types of objects. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92754 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/TableGen')
-rw-r--r--test/TableGen/eq.td13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/TableGen/eq.td b/test/TableGen/eq.td
new file mode 100644
index 0000000000..8ba6d7ec83
--- /dev/null
+++ b/test/TableGen/eq.td
@@ -0,0 +1,13 @@
+// RUN: tblgen %s | FileCheck %s
+// CHECK: Value = 0
+// CHECK: Value = 1
+
+class Base<int V> {
+ int Value = V;
+}
+
+class Derived<string Truth> :
+ Base<!if(!eq(Truth, "true"), 1, 0)>;
+
+def TRUE : Derived<"true">;
+def FALSE : Derived<"false">;