Skip to content

Commit

Permalink
Print NewPM passes
Browse files Browse the repository at this point in the history
-C passes=list was printing passes for the legacy pass manager.
Use PassBuilder::printPassNames() to print NewPM passes instead.
  • Loading branch information
nikic committed Mar 1, 2023
1 parent 45f694d commit 655a810
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 655a810

Please sign in to comment.