llvm.org GIT mirror llvm / d8fa26e
[TableGen] Don't quote variable name when printing !foreach. An input !foreach expression such as !foreach(a, lst, !add(a, 1)) would be re-emitted by llvm-tblgen -print-records with the first argument in quotes, giving !foreach("a", lst, !add(a, 1)), which isn't valid TableGen input syntax. Reviewers: nhaehnle Reviewed By: nhaehnle Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D46352 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331351 91177308-0d34-0410-b5e6-96231b3b80d8 Simon Tatham 1 year, 5 months ago
2 changed file(s) with 8 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
11951195
11961196 std::string TernOpInit::getAsString() const {
11971197 std::string Result;
1198 bool UnquotedLHS = false;
11981199 switch (getOpcode()) {
11991200 case SUBST: Result = "!subst"; break;
1200 case FOREACH: Result = "!foreach"; break;
1201 case FOREACH: Result = "!foreach"; UnquotedLHS = true; break;
12011202 case IF: Result = "!if"; break;
12021203 case DAG: Result = "!dag"; break;
12031204 }
1204 return Result + "(" + LHS->getAsString() + ", " + MHS->getAsString() + ", " +
1205 RHS->getAsString() + ")";
1205 return (Result + "(" +
1206 (UnquotedLHS ? LHS->getAsUnquotedString() : LHS->getAsString()) +
1207 ", " + MHS->getAsString() + ", " + RHS->getAsString() + ")");
12061208 }
12071209
12081210 static void ProfileFoldOpInit(FoldingSetNodeID &ID, Init *A, Init *B,
0 // RUN: llvm-tblgen %s | FileCheck %s
11 // XFAIL: vg_leak
2
3 // CHECK: --- Classes ---
4 // CHECK: list ret = !foreach(a,
25
36 // CHECK: --- Defs ---
47