[PATCH] [tablegen] !strconcat accepts more than two arguments but this wasn't documented or tested.
Daniel Sanders
daniel.sanders at imgtec.com
Thu Apr 24 09:15:02 PDT 2014
* Updated the documentation
* Added a test for >2 arguments
* Added a check for the lexical concatenation
* Made the existing test a bit stricter.
http://reviews.llvm.org/D3485
Files:
docs/TableGen/LangIntro.rst
test/TableGen/strconcat.td
Index: docs/TableGen/LangIntro.rst
===================================================================
--- docs/TableGen/LangIntro.rst
+++ docs/TableGen/LangIntro.rst
@@ -162,6 +162,8 @@
``!strconcat(a, b)``
A string value that is the result of concatenating the 'a' and 'b' strings.
+ More than two arguments are accepted with the result being the concatenation
+ of all the strings given.
``str1#str2``
"#" (paste) is a shorthand for !strconcat. It may concatenate things that
Index: test/TableGen/strconcat.td
===================================================================
--- test/TableGen/strconcat.td
+++ test/TableGen/strconcat.td
@@ -1,9 +1,21 @@
// RUN: llvm-tblgen %s | FileCheck %s
-// CHECK: fufoo
+// CHECK: class Y<string Y:S = ?> {
+// CHECK: string T = !strconcat(Y:S, "foo");
+// CHECK: string T2 = !strconcat(Y:S, !strconcat("foo", !strconcat(Y:S, "bar")));
+// CHECK: string S = "foobar";
+// CHECK: }
+
+// CHECK: def Z {
+// CHECK: string T = "fufoo";
+// CHECK: string T2 = "fufoofubar";
+// CHECK: string S = "foobar";
+// CHECK: }
class Y<string S> {
string T = !strconcat(S, "foo");
+ // More than two arguments is equivalent to nested calls
+ string T2 = !strconcat(S, "foo", S, "bar");
// String values concatenate lexically, as in C.
string S = "foo" "bar";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3485.8807.patch
Type: text/x-patch
Size: 1345 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140424/d900ee19/attachment.bin>
More information about the llvm-commits
mailing list