summaryrefslogtreecommitdiff
path: root/test/TableGen
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2014-01-02 20:47:09 +0000
committerHal Finkel <hfinkel@anl.gov>2014-01-02 20:47:09 +0000
commit0a3368cde5e9e74c39c4be64f81d7c7ffa3480f6 (patch)
tree0cd6a3a8b6b85acfa2c6e73e60cb7e11c186cdfe /test/TableGen
parent6fa9961327822d9c15f36a52b1aafce69ee9a404 (diff)
downloadllvm-0a3368cde5e9e74c39c4be64f81d7c7ffa3480f6.tar.gz
llvm-0a3368cde5e9e74c39c4be64f81d7c7ffa3480f6.tar.bz2
llvm-0a3368cde5e9e74c39c4be64f81d7c7ffa3480f6.tar.xz
[TableGen] Correctly generate implicit anonymous prototype defs in multiclasses
Even within a multiclass, we had been generating concrete implicit anonymous defs when parsing values (generally in value lists). This behavior was incorrect, and led to errors when multiclass parameters were used in the parameter list of the implicit anonymous def. If we had some multiclass: multiclass mc<string n> { ... : SomeClass<SomeOtherClass<n> > The capture of the multiclass parameter 'n' would not work correctly, and depending on how the implicit SomeOtherClass was used, either TableGen would ignore something it shouldn't, or would crash. To fix this problem, when inside a multiclass, we generate prototype anonymous defs for implicit anonymous defs (just as we do for explicit anonymous defs). Within the multiclass, the current record prototype is populated with a node that is essentially: !cast<SomeOtherClass>(!strconcat(NAME, anon_value_name)). This is then resolved to the correct concrete anonymous def, in the usual way, when NAME is resolved during multiclass instantiation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198348 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/TableGen')
-rw-r--r--test/TableGen/MultiClassDefName.td10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/TableGen/MultiClassDefName.td b/test/TableGen/MultiClassDefName.td
index 69b951d378..811d92667e 100644
--- a/test/TableGen/MultiClassDefName.td
+++ b/test/TableGen/MultiClassDefName.td
@@ -29,3 +29,13 @@ multiclass MC<string name> {
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">;
+