aboutsummaryrefslogtreecommitdiffstats
path: root/test/TableGen
diff options
context:
space:
mode:
Diffstat (limited to 'test/TableGen')
-rw-r--r--test/TableGen/MultiClassDefName.td25
-rw-r--r--test/TableGen/ValidIdentifiers.td16
2 files changed, 41 insertions, 0 deletions
diff --git a/test/TableGen/MultiClassDefName.td b/test/TableGen/MultiClassDefName.td
index d3c6de7..811d9266 100644
--- a/test/TableGen/MultiClassDefName.td
+++ b/test/TableGen/MultiClassDefName.td
@@ -14,3 +14,28 @@ multiclass Names<string n, string m> {
}
defm Hello : Names<"hello", "world">;
+
+// Ensure that the same anonymous name is used as the prefix for all defs in an
+// anonymous multiclass.
+
+class Outer<C i> {
+ C Inner = i;
+}
+
+multiclass MC<string name> {
+ def hi : C<name>;
+ def there : Outer<!cast<C>(!strconcat(NAME, "hi"))>;
+}
+
+defm : MC<"foo">;
+
+multiclass MC2<string name> {
+ def there : Outer<C<name> >;
+}
+
+// Ensure that we've correctly captured the reference to name from the implicit
+// anonymous C def in the template parameter list of Outer.
+// CHECK-NOT: MC2::name
+
+defm : MC2<"bar">;
+
diff --git a/test/TableGen/ValidIdentifiers.td b/test/TableGen/ValidIdentifiers.td
new file mode 100644
index 0000000..333ede0
--- /dev/null
+++ b/test/TableGen/ValidIdentifiers.td
@@ -0,0 +1,16 @@
+// RUN: llvm-tblgen -gen-ctags %s | FileCheck %s
+// XFAIL: vg_leak
+
+// Ensure that generated names for anonymous records are valid identifiers via the ctags index.
+
+class foo<int X> { int THEVAL = X; }
+// CHECK: {{^X }}
+
+def : foo<2>;
+// CHECK: {{^anonymous_0 }}
+
+def X {
+ foo Y = foo<1>;
+}
+// CHECK: {{^anonymous_1 }}
+// CHECK: {{^foo }}