[PATCH] D46352: [TableGen] Don't quote variable name when printing !foreach.
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 2 06:21:17 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL331351: [TableGen] Don't quote variable name when printing !foreach. (authored by statham, committed by ).
Repository:
rL LLVM
https://reviews.llvm.org/D46352
Files:
llvm/trunk/lib/TableGen/Record.cpp
llvm/trunk/test/TableGen/foreach-leak.td
Index: llvm/trunk/test/TableGen/foreach-leak.td
===================================================================
--- llvm/trunk/test/TableGen/foreach-leak.td
+++ llvm/trunk/test/TableGen/foreach-leak.td
@@ -1,6 +1,9 @@
// RUN: llvm-tblgen %s | FileCheck %s
// XFAIL: vg_leak
+// CHECK: --- Classes ---
+// CHECK: list<int> ret = !foreach(a,
+
// CHECK: --- Defs ---
// CHECK: def C0 {
Index: llvm/trunk/lib/TableGen/Record.cpp
===================================================================
--- llvm/trunk/lib/TableGen/Record.cpp
+++ llvm/trunk/lib/TableGen/Record.cpp
@@ -1196,14 +1196,16 @@
std::string TernOpInit::getAsString() const {
std::string Result;
+ bool UnquotedLHS = false;
switch (getOpcode()) {
case SUBST: Result = "!subst"; break;
- case FOREACH: Result = "!foreach"; break;
+ case FOREACH: Result = "!foreach"; UnquotedLHS = true; break;
case IF: Result = "!if"; break;
case DAG: Result = "!dag"; break;
}
- return Result + "(" + LHS->getAsString() + ", " + MHS->getAsString() + ", " +
- RHS->getAsString() + ")";
+ return (Result + "(" +
+ (UnquotedLHS ? LHS->getAsUnquotedString() : LHS->getAsString()) +
+ ", " + MHS->getAsString() + ", " + RHS->getAsString() + ")");
}
static void ProfileFoldOpInit(FoldingSetNodeID &ID, Init *A, Init *B,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46352.144872.patch
Type: text/x-patch
Size: 1332 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180502/9f1b2aec/attachment.bin>
More information about the llvm-commits
mailing list