llvm.org GIT mirror llvm / 1913eeb
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207865 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Sanders 5 years ago
2 changed file(s) with 16 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
159159 remaining elements in the list may be arbitrary other values, including
160160 nested ```dag``' values.
161161
162 ``!strconcat(a, b)``
162 ``!strconcat(a, b, ...)``
163163 A string value that is the result of concatenating the 'a' and 'b' strings.
164 More than two arguments are accepted with the result being the concatenation
165 of all the strings given.
164166
165167 ``str1#str2``
166168 "#" (paste) is a shorthand for !strconcat. It may concatenate things that
0 // RUN: llvm-tblgen %s | FileCheck %s
11
2 // CHECK: fufoo
2 // CHECK: class Y {
3 // CHECK: string T = !strconcat(Y:S, "foo");
4 // CHECK: string T2 = !strconcat(Y:S, !strconcat("foo", !strconcat(Y:S, "bar")));
5 // CHECK: string S = "foobar";
6 // CHECK: }
7
8 // CHECK: def Z {
9 // CHECK: string T = "fufoo";
10 // CHECK: string T2 = "fufoofubar";
11 // CHECK: string S = "foobar";
12 // CHECK: }
313
414 class Y {
515 string T = !strconcat(S, "foo");
16 // More than two arguments is equivalent to nested calls
17 string T2 = !strconcat(S, "foo", S, "bar");
618
719 // String values concatenate lexically, as in C.
820 string S = "foo" "bar";