Convert more tools code from cerr and cout to errs() and outs().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76070 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/bugpoint/BugDriver.cpp b/tools/bugpoint/BugDriver.cpp
index ac5de15..0934206 100644
--- a/tools/bugpoint/BugDriver.cpp
+++ b/tools/bugpoint/BugDriver.cpp
@@ -25,7 +25,6 @@
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h"
-#include <iostream>
#include <memory>
using namespace llvm;
@@ -107,14 +106,14 @@
if (Program == 0) return true;
if (!run_as_child)
- std::cout << "Read input file : '" << Filenames[0] << "'\n";
+ outs() << "Read input file : '" << Filenames[0] << "'\n";
for (unsigned i = 1, e = Filenames.size(); i != e; ++i) {
std::auto_ptr<Module> M(ParseInputFile(Filenames[i], Context));
if (M.get() == 0) return true;
if (!run_as_child)
- std::cout << "Linking in input file: '" << Filenames[i] << "'\n";
+ outs() << "Linking in input file: '" << Filenames[i] << "'\n";
std::string ErrorMessage;
if (Linker::LinkModules(Program, M.get(), &ErrorMessage)) {
errs() << ToolName << ": error linking in '" << Filenames[i] << "': "
@@ -128,7 +127,7 @@
}
if (!run_as_child)
- std::cout << "*** All input ok\n";
+ outs() << "*** All input ok\n";
// All input files read successfully!
return false;
@@ -162,7 +161,7 @@
// file, then we know the compiler didn't crash, so try to diagnose a
// miscompilation.
if (!PassesToRun.empty()) {
- std::cout << "Running selected passes on program to test for crash: ";
+ outs() << "Running selected passes on program to test for crash: ";
if (runPasses(PassesToRun))
return debugOptimizerCrash();
}
@@ -171,12 +170,12 @@
if (initializeExecutionEnvironment()) return true;
// Test to see if we have a code generator crash.
- std::cout << "Running the code generator to test for a crash: ";
+ outs() << "Running the code generator to test for a crash: ";
try {
compileProgram(Program);
- std::cout << '\n';
+ outs() << '\n';
} catch (ToolExecutionError &TEE) {
- std::cout << TEE.what();
+ outs() << TEE.what();
return debugCodeGeneratorCrash();
}
@@ -187,7 +186,7 @@
//
bool CreatedOutput = false;
if (ReferenceOutputFile.empty()) {
- std::cout << "Generating reference output from raw program: ";
+ outs() << "Generating reference output from raw program: ";
if(!createReferenceFile(Program)){
return debugCodeGeneratorCrash();
}
@@ -202,10 +201,10 @@
// Diff the output of the raw program against the reference output. If it
// matches, then we assume there is a miscompilation bug and try to
// diagnose it.
- std::cout << "*** Checking the code generator...\n";
+ outs() << "*** Checking the code generator...\n";
try {
if (!diffProgram()) {
- std::cout << "\n*** Output matches: Debugging miscompilation!\n";
+ outs() << "\n*** Output matches: Debugging miscompilation!\n";
return debugMiscompilation();
}
} catch (ToolExecutionError &TEE) {
@@ -213,8 +212,8 @@
return debugCodeGeneratorCrash();
}
- std::cout << "\n*** Input program does not match reference diff!\n";
- std::cout << "Debugging code generator problem!\n";
+ outs() << "\n*** Input program does not match reference diff!\n";
+ outs() << "Debugging code generator problem!\n";
try {
return debugCodeGenerator();
} catch (ToolExecutionError &TEE) {
@@ -227,18 +226,18 @@
unsigned NumPrint = Funcs.size();
if (NumPrint > 10) NumPrint = 10;
for (unsigned i = 0; i != NumPrint; ++i)
- std::cout << " " << Funcs[i]->getName();
+ outs() << " " << Funcs[i]->getName();
if (NumPrint < Funcs.size())
- std::cout << "... <" << Funcs.size() << " total>";
- std::cout << std::flush;
+ outs() << "... <" << Funcs.size() << " total>";
+ outs().flush();
}
void llvm::PrintGlobalVariableList(const std::vector<GlobalVariable*> &GVs) {
unsigned NumPrint = GVs.size();
if (NumPrint > 10) NumPrint = 10;
for (unsigned i = 0; i != NumPrint; ++i)
- std::cout << " " << GVs[i]->getName();
+ outs() << " " << GVs[i]->getName();
if (NumPrint < GVs.size())
- std::cout << "... <" << GVs.size() << " total>";
- std::cout << std::flush;
+ outs() << "... <" << GVs.size() << " total>";
+ outs().flush();
}