357 changes: 0 additions & 357 deletions llvm/lib/Support/Format.cpp

This file was deleted.

17 changes: 6 additions & 11 deletions llvm/lib/TableGen/SetTheory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,26 +210,21 @@ struct SequenceOp : public SetTheory::Operator {
PrintFatalError(Loc, "To out of range");

RecordKeeper &Records =
cast<DefInit>(Expr->getOperator())->getDef()->getRecords();
cast<DefInit>(Expr->getOperator())->getDef()->getRecords();

Step *= From <= To ? 1 : -1;
const char FallbackFmt[] = "%u";
while (true) {
if (Step > 0 && From > To)
break;
else if (Step < 0 && From < To)
break;
const char *const VerifiedFmt = PrintfStyleFormatReader::ensureCompatible(
FallbackFmt, Format.c_str());
if (VerifiedFmt == FallbackFmt)
PrintFatalError(Loc, "Format string '" + Format +
"' is incompatible with '%u'!");
std::string Name;
raw_string_ostream(Name) << format(VerifiedFmt, unsigned(From));
Record *Rec = Records.getDef(Name);
raw_string_ostream OS(Name);
OS << format(Format.c_str(), unsigned(From));
Record *Rec = Records.getDef(OS.str());
if (!Rec)
PrintFatalError(Loc,
"No def named '" + Name + "': " + Expr->getAsString());
PrintFatalError(Loc, "No def named '" + Name + "': " +
Expr->getAsString());
// Try to reevaluate Rec in case it is a set.
if (const RecVec *Result = ST.expand(Rec))
Elts.insert(Result->begin(), Result->end());
Expand Down
1 change: 0 additions & 1 deletion llvm/unittests/Support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ add_llvm_unittest(SupportTests
FileCollectorTest.cpp
FileOutputBufferTest.cpp
FileUtilitiesTest.cpp
FormatChkTest.cpp
FormatVariadicTest.cpp
FSUniqueIDTest.cpp
GlobPatternTest.cpp
Expand Down
314 changes: 0 additions & 314 deletions llvm/unittests/Support/FormatChkTest.cpp

This file was deleted.

9 changes: 4 additions & 5 deletions llvm/utils/TableGen/GlobalISel/GIMatchDag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,10 @@ void GIMatchDag::writeDOTGraph(raw_ostream &OS, StringRef ID) const {
const char *ToFmt = "Node%p:d%d:s";
if (E->getFromMO()->isDef() && !E->getToMO()->isDef())
std::swap(FromFmt, ToFmt);
auto FromF = format(FromFmt, E->getFromMI(), E->getFromMO()->getIdx());
auto ToF = format(ToFmt, E->getToMI(), E->getToMO()->getIdx());
bool Swap = E->getFromMO()->isDef() && !E->getToMO()->isDef();
auto &From = Swap ? ToF : FromF;
auto &To = Swap ? FromF : ToF;
auto From = format(FromFmt, E->getFromMI(), E->getFromMO()->getIdx());
auto To = format(ToFmt, E->getToMI(), E->getToMO()->getIdx());
if (E->getFromMO()->isDef() && !E->getToMO()->isDef())
std::swap(From, To);

OS << " " << From << " -> " << To << " [label=\"$" << E->getName();
if (E->getFromMO()->isDef() == E->getToMO()->isDef())
Expand Down