[tablegen] !strconcat accepts more than two arguments but this wasn't documented...
authorDaniel Sanders <daniel.sanders@imgtec.com>
Fri, 2 May 2014 19:25:52 +0000 (19:25 +0000)
committerDaniel Sanders <daniel.sanders@imgtec.com>
Fri, 2 May 2014 19:25:52 +0000 (19:25 +0000)
Summary:
* Updated the documentation
* Added a test for >2 arguments
* Added a check for the lexical concatenation
* Made the existing test a bit stricter.

Reviewers: t.p.northover

Reviewed By: t.p.northover

Subscribers: t.p.northover, llvm-commits

Differential Revision: http://reviews.llvm.org/D3485

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207865 91177308-0d34-0410-b5e6-96231b3b80d8

docs/TableGen/LangIntro.rst
test/TableGen/strconcat.td

index f139f359649193eda360f43bb084fec89f2325a8..5b6094fa91fd619c642f9a3d9526586b8b950ccf 100644 (file)
@@ -160,8 +160,10 @@ supported include:
     remaining elements in the list may be arbitrary other values, including
     nested ```dag``' values.
 
-``!strconcat(a, b)``
+``!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 dfb1a94d82c8b25767f2f1d8770ad4fa51995966..f5d7512fd69506761c99a1e26ea911dd819c7085 100644 (file)
@@ -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";