From a365abd544fd28d93759b03980b01fd33244fbdd Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sat, 28 Jun 2025 14:50:28 -0700 Subject: [PATCH] MCExpr: Remove error-prone operator<< Printing an expression is error-prone without a MCAsmInfo argument. The callers have migrated to MCAsmInfo::printExpr or MCExpr::print. --- llvm/include/llvm/MC/MCExpr.h | 5 ----- llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/llvm/include/llvm/MC/MCExpr.h b/llvm/include/llvm/MC/MCExpr.h index 29365cdaaa06..e7f97c627f64 100644 --- a/llvm/include/llvm/MC/MCExpr.h +++ b/llvm/include/llvm/MC/MCExpr.h @@ -134,11 +134,6 @@ public: MCValue &); }; -inline raw_ostream &operator<<(raw_ostream &OS, const MCExpr &E) { - E.print(OS, nullptr); - return OS; -} - //// Represent a constant integer expression. class MCConstantExpr : public MCExpr { int64_t Value; diff --git a/llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp b/llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp index c74011b16475..727f83d43c8a 100644 --- a/llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp +++ b/llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp @@ -441,10 +441,10 @@ public: switch (Kind) { case CPOP: - OS << *getConstpoolOp(); + MAI.printExpr(OS, *getConstpoolOp()); break; case Immediate: - OS << *getImm(); + MAI.printExpr(OS, *getImm()); break; case KindTy::Register: OS << "";