diff options
author | Hal Finkel <hfinkel@anl.gov> | 2014-01-02 19:35:33 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2014-01-02 19:35:33 +0000 |
commit | 2370e55a535331c849371ed52a3f62b8c5f315a3 (patch) | |
tree | 2abb28819fd5330245ed51b2daa7a0841e09d435 /test/TableGen | |
parent | fcbe3d950148f01ed8ed47afda78a13f81a8010b (diff) | |
download | llvm-2370e55a535331c849371ed52a3f62b8c5f315a3.tar.gz llvm-2370e55a535331c849371ed52a3f62b8c5f315a3.tar.bz2 llvm-2370e55a535331c849371ed52a3f62b8c5f315a3.tar.xz |
[TableGen] Use the same anonymous name as the prefix on all multiclass defs
TableGen had been generating a different name for an anonymous multiclass's
NAME for every def in the multiclass. This had an unfortunate side effect: it
was impossible to reference one def within the multiclass from another (in the
parameter list, for example). By making sure we only generate an anonymous name
once per multiclass (which, as it turns out, requires only changing the name
parameter to reference type), we can now concatenate NAME within the multiclass
with a def name in order to generate a reference to that def.
This does not matter so much, in and of itself, but is necessary for a
follow-up commit that will fix variable capturing in implicit anonymous
multiclass defs (and that is important).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198340 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/TableGen')
-rw-r--r-- | test/TableGen/MultiClassDefName.td | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/TableGen/MultiClassDefName.td b/test/TableGen/MultiClassDefName.td index d3c6de7e84..69b951d378 100644 --- a/test/TableGen/MultiClassDefName.td +++ b/test/TableGen/MultiClassDefName.td @@ -14,3 +14,18 @@ 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">; + |