forked from OSchip/llvm-project
[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:
parent
e222d92707
commit
6a02604ee4
|
@ -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,
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue