[llvm] r207865 - [tablegen] !strconcat accepts more than two arguments but this wasn't documented or tested.
Daniel Sanders
daniel.sanders at imgtec.com
Fri May 2 12:25:52 PDT 2014
Author: dsanders
Date: Fri May 2 14:25:52 2014
New Revision: 207865
URL: http://llvm.org/viewvc/llvm-project?rev=207865&view=rev
Log:
[tablegen] !strconcat accepts more than two arguments but this wasn't documented or tested.
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
Modified:
llvm/trunk/docs/TableGen/LangIntro.rst
llvm/trunk/test/TableGen/strconcat.td
Modified: llvm/trunk/docs/TableGen/LangIntro.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/TableGen/LangIntro.rst?rev=207865&r1=207864&r2=207865&view=diff
==============================================================================
--- llvm/trunk/docs/TableGen/LangIntro.rst (original)
+++ llvm/trunk/docs/TableGen/LangIntro.rst Fri May 2 14:25:52 2014
@@ -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
Modified: llvm/trunk/test/TableGen/strconcat.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/strconcat.td?rev=207865&r1=207864&r2=207865&view=diff
==============================================================================
--- llvm/trunk/test/TableGen/strconcat.td (original)
+++ llvm/trunk/test/TableGen/strconcat.td Fri May 2 14:25:52 2014
@@ -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";
More information about the llvm-commits
mailing list