-int BugDriver::runPassesAsChild(const std::vector<const PassInfo*> &Passes) {
-
- std::ios::openmode io_mode = std::ios::out | std::ios::trunc |
- std::ios::binary;
- std::ofstream OutFile(ChildOutput.c_str(), io_mode);
- if (!OutFile.good()) {
- cerr << "Error opening bitcode file: " << ChildOutput << "\n";
- return 1;
- }
-
- PassManager PM;
- // Make sure that the appropriate target data is always used...
- PM.add(new TargetData(Program));
-
- for (unsigned i = 0, e = Passes.size(); i != e; ++i) {
- if (Passes[i]->getNormalCtor())
- PM.add(Passes[i]->getNormalCtor()());
- else
- cerr << "Cannot create pass yet: " << Passes[i]->getPassName() << "\n";
- }
- // Check that the module is well formed on completion of optimization
- PM.add(createVerifierPass());
-
- // Write bitcode out to disk as the last step...
- PM.add(CreateBitcodeWriterPass(OutFile));
+cl::opt<bool> SilencePasses("silence-passes",
+ cl::desc("Suppress output of running passes (both stdout and stderr)"));