Index: lib/IR/IRPrintingPasses.cpp =================================================================== --- lib/IR/IRPrintingPasses.cpp +++ lib/IR/IRPrintingPasses.cpp @@ -60,10 +60,14 @@ public: static char ID; - PrintModulePassWrapper() : ModulePass(ID) {} + PrintModulePassWrapper() : ModulePass(ID) { + initializePrintModulePassWrapperPass(*PassRegistry::getPassRegistry()); + } PrintModulePassWrapper(raw_ostream &OS, const std::string &Banner, bool ShouldPreserveUseListOrder) - : ModulePass(ID), P(OS, Banner, ShouldPreserveUseListOrder) {} + : ModulePass(ID), P(OS, Banner, ShouldPreserveUseListOrder) { + initializePrintModulePassWrapperPass(*PassRegistry::getPassRegistry()); + } bool runOnModule(Module &M) override { ModuleAnalysisManager DummyMAM; @@ -83,9 +87,13 @@ public: static char ID; - PrintFunctionPassWrapper() : FunctionPass(ID) {} + PrintFunctionPassWrapper() : FunctionPass(ID) { + initializePrintFunctionPassWrapperPass(*PassRegistry::getPassRegistry()); + } PrintFunctionPassWrapper(raw_ostream &OS, const std::string &Banner) - : FunctionPass(ID), P(OS, Banner) {} + : FunctionPass(ID), P(OS, Banner) { + initializePrintFunctionPassWrapperPass(*PassRegistry::getPassRegistry()); + } // This pass just prints a banner followed by the function as it's processed. bool runOnFunction(Function &F) override { @@ -107,9 +115,13 @@ public: static char ID; - PrintBasicBlockPass() : BasicBlockPass(ID), Out(dbgs()) {} + PrintBasicBlockPass() : BasicBlockPass(ID), Out(dbgs()) { + initializePrintBasicBlockPassPass(*PassRegistry::getPassRegistry()); + } PrintBasicBlockPass(raw_ostream &Out, const std::string &Banner) - : BasicBlockPass(ID), Out(Out), Banner(Banner) {} + : BasicBlockPass(ID), Out(Out), Banner(Banner) { + initializePrintBasicBlockPassPass(*PassRegistry::getPassRegistry()); + } bool runOnBasicBlock(BasicBlock &BB) override { Out << Banner << BB; @@ -123,7 +135,7 @@ StringRef getPassName() const override { return "Print BasicBlock IR"; } }; -} +} // end anonymous namespace char PrintModulePassWrapper::ID = 0; INITIALIZE_PASS(PrintModulePassWrapper, "print-module", Index: test/Other/printer.c =================================================================== --- /dev/null +++ test/Other/printer.c @@ -0,0 +1,9 @@ +// RUN: clang -mllvm -debug-pass=Arguments -mllvm -print-after-all -emit-llvm -S -o - %s 2>&1 | \ +// RUN: FileCheck %s + +int foo() { + return 0; +} + +// CHECK: Pass Arguments: -tti -targetlibinfo -verify -print-function -ee-instrument -print-function +// CHECK: Pass Arguments: -tti -targetlibinfo -assumption-cache-tracker -profile-summary-info -forceattrs -print-module -basiccg -always-inline