1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

[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

llvm-svn: 331351
This commit is contained in:
Simon Tatham 2018-05-02 13:17:26 +00:00
parent 617d4ec81a
commit 1754ebf170
2 changed files with 8 additions and 3 deletions

View File

@ -1196,14 +1196,16 @@ Init *TernOpInit::resolveReferences(Resolver &R) const {
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,

View File

@ -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 {