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, 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 ret = !foreach(a, + // CHECK: --- Defs --- // CHECK: def C0 {