diff options
author | Fangrui Song <i@maskray.me> | 2025-06-28 14:41:57 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2025-06-28 14:41:58 -0700 |
commit | e6b25288eb0a9374cb92b0a86ce364d0929d2752 (patch) | |
tree | 82f08e896a748f762a8e52f1bd30f410fa349a34 /llvm/lib/MC/MCExpr.cpp | |
parent | 5ffdd9480d80719dc0ff83417ae58a91c157fd79 (diff) | |
download | llvm-e6b25288eb0a9374cb92b0a86ce364d0929d2752.zip llvm-e6b25288eb0a9374cb92b0a86ce364d0929d2752.tar.gz llvm-e6b25288eb0a9374cb92b0a86ce364d0929d2752.tar.bz2 |
MCExpr: Migrate away from operator<<
Printing an expression is error-prone without a MCAsmInfo argument.
Remove the operator<< overload and replace callers with
MCAsmInfo::printExpr. Some callers are changed to MCExpr::print, with
the goal of eventually making it private.
Diffstat (limited to 'llvm/lib/MC/MCExpr.cpp')
-rw-r--r-- | llvm/lib/MC/MCExpr.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp index aca3ec6..7603912 100644 --- a/llvm/lib/MC/MCExpr.cpp +++ b/llvm/lib/MC/MCExpr.cpp @@ -179,7 +179,9 @@ void MCExpr::print(raw_ostream &OS, const MCAsmInfo *MAI, return MAI->printSpecifierExpr(OS, SE); // Used by dump features like -show-inst. Regular MCAsmStreamer output must // set MAI. - OS << "specifier(" << SE.getSpecifier() << ',' << *SE.getSubExpr() << ')'; + OS << "specifier(" << SE.getSpecifier() << ','; + SE.getSubExpr()->print(OS, nullptr); + OS << ')'; return; } } @@ -189,7 +191,7 @@ void MCExpr::print(raw_ostream &OS, const MCAsmInfo *MAI, #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) LLVM_DUMP_METHOD void MCExpr::dump() const { - dbgs() << *this; + print(dbgs(), nullptr); dbgs() << '\n'; } #endif |