about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2023-03-01 09:26:00 +0100
committerNikita Popov <npopov@redhat.com>2023-03-01 09:26:00 +0100
commit655a810b665053ebef1739a3b662b79d232d75f4 (patch)
tree878d44b06bc69cf8f16278d539d8e8d116b5869a /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
parent45f694dbba5de87e64aa771e82247a8b803b8764 (diff)
downloadrust-655a810b665053ebef1739a3b662b79d232d75f4.tar.gz
rust-655a810b665053ebef1739a3b662b79d232d75f4.zip
Print NewPM passes
-C passes=list was printing passes for the legacy pass manager.
Use PassBuilder::printPassNames() to print NewPM passes instead.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp18
1 files changed, 2 insertions, 16 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
index d15a15a9a1f..4761ce83fab 100644
--- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
@@ -987,22 +987,8 @@ LLVMRustPrintModule(LLVMModuleRef M, const char *Path, DemangleFn Demangle) {
 }
 
 extern "C" void LLVMRustPrintPasses() {
-  struct MyListener : PassRegistrationListener {
-    void passEnumerate(const PassInfo *Info) {
-      StringRef PassArg = Info->getPassArgument();
-      StringRef PassName = Info->getPassName();
-      if (!PassArg.empty()) {
-        // These unsigned->signed casts could theoretically overflow, but
-        // realistically never will (and even if, the result is implementation
-        // defined rather plain UB).
-        printf("%15.*s - %.*s\n", (int)PassArg.size(), PassArg.data(),
-               (int)PassName.size(), PassName.data());
-      }
-    }
-  } Listener;
-
-  PassRegistry *PR = PassRegistry::getPassRegistry();
-  PR->enumerateWith(&Listener);
+  PassBuilder PB;
+  PB.printPassNames(outs());
 }
 
 extern "C" void LLVMRustRunRestrictionPass(LLVMModuleRef M, char **Symbols,