std::cout << "Linking in input file: '" << Filenames[i] << "'\n";
std::string ErrorMessage;
if (Linker::LinkModules(Program, M.get(), &ErrorMessage)) {
- std::cerr << ToolName << ": error linking in '" << Filenames[i] << "': "
- << ErrorMessage << '\n';
+ errs() << ToolName << ": error linking in '" << Filenames[i] << "': "
+ << ErrorMessage << '\n';
return true;
}
}
} catch (const std::string &Error) {
- std::cerr << ToolName << ": error reading input '" << Error << "'\n";
+ errs() << ToolName << ": error reading input '" << Error << "'\n";
return true;
}
return debugMiscompilation();
}
} catch (ToolExecutionError &TEE) {
- std::cerr << TEE.what();
+ errs() << TEE.what();
return debugCodeGeneratorCrash();
}
try {
return debugCodeGenerator();
} catch (ToolExecutionError &TEE) {
- std::cerr << TEE.what();
+ errs() << TEE.what();
return debugCodeGeneratorCrash();
}
}
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Support/FileUtilities.h"
#include "llvm/Support/CommandLine.h"
+#include <iostream>
#include <fstream>
#include <set>
using namespace llvm;
BD.Program = ParseInputFile(PrefixOutput.toString(), BD.getContext());
if (BD.Program == 0) {
- std::cerr << BD.getToolName() << ": Error reading bitcode file '"
- << PrefixOutput << "'!\n";
+ errs() << BD.getToolName() << ": Error reading bitcode file '"
+ << PrefixOutput << "'!\n";
exit(1);
}
PrefixOutput.eraseFromDisk();
static bool TestForCodeGenCrash(BugDriver &BD, Module *M) {
try {
BD.compileProgram(M);
- std::cerr << '\n';
+ errs() << '\n';
return false;
} catch (ToolExecutionError &) {
- std::cerr << "<crash>\n";
+ errs() << "<crash>\n";
return true; // Tool is still crashing.
}
}
/// crashes on an input. It attempts to reduce the input as much as possible
/// while still causing the code generator to crash.
bool BugDriver::debugCodeGeneratorCrash() {
- std::cerr << "*** Debugging code generator crash!\n";
+ errs() << "*** Debugging code generator crash!\n";
return DebugACrash(*this, TestForCodeGenCrash);
}
break;
}
if (!Interpreter)
- std::cerr << Message;
+ errs() << Message;
else // Display informational messages on stdout instead of stderr
std::cout << Message;
sys::Path BitcodeFile ("bugpoint-test-program.bc");
std::string ErrMsg;
if (BitcodeFile.makeUnique(true,&ErrMsg)) {
- std::cerr << ToolName << ": Error making unique filename: " << ErrMsg
- << "\n";
+ errs() << ToolName << ": Error making unique filename: " << ErrMsg
+ << "\n";
exit(1);
}
if (writeProgramToFile(BitcodeFile.toString(), M)) {
- std::cerr << ToolName << ": Error emitting bitcode to file '"
- << BitcodeFile << "'!\n";
+ errs() << ToolName << ": Error emitting bitcode to file '"
+ << BitcodeFile << "'!\n";
exit(1);
}
// Emit the program to a bitcode file...
sys::Path uniqueFilename("bugpoint-test-program.bc");
if (uniqueFilename.makeUnique(true, &ErrMsg)) {
- std::cerr << ToolName << ": Error making unique filename: "
- << ErrMsg << "!\n";
+ errs() << ToolName << ": Error making unique filename: "
+ << ErrMsg << "!\n";
exit(1);
}
BitcodeFile = uniqueFilename.toString();
if (writeProgramToFile(BitcodeFile, Program)) {
- std::cerr << ToolName << ": Error emitting bitcode to file '"
- << BitcodeFile << "'!\n";
+ errs() << ToolName << ": Error emitting bitcode to file '"
+ << BitcodeFile << "'!\n";
exit(1);
}
CreatedBitcode = true;
// Check to see if this is a valid output filename...
sys::Path uniqueFile(OutputFile);
if (uniqueFile.makeUnique(true, &ErrMsg)) {
- std::cerr << ToolName << ": Error making unique filename: "
- << ErrMsg << "\n";
+ errs() << ToolName << ": Error making unique filename: "
+ << ErrMsg << "\n";
exit(1);
}
OutputFile = uniqueFile.toString();
Timeout, MemoryLimit);
if (RetVal == -1) {
- std::cerr << "<timeout>";
+ errs() << "<timeout>";
static bool FirstTimeout = true;
if (FirstTimeout) {
std::cout << "\n"
ReferenceOutputFile = executeProgramSafely(Filename);
std::cout << "\nReference output is: " << ReferenceOutputFile << "\n\n";
} catch (ToolExecutionError &TEE) {
- std::cerr << TEE.what();
+ errs() << TEE.what();
if (Interpreter != SafeInterpreter) {
- std::cerr << "*** There is a bug running the \"safe\" backend. Either"
- << " debug it (for example with the -run-cbe bugpoint option,"
- << " if CBE is being used as the \"safe\" backend), or fix the"
- << " error some other way.\n";
+ errs() << "*** There is a bug running the \"safe\" backend. Either"
+ << " debug it (for example with the -run-cbe bugpoint option,"
+ << " if CBE is being used as the \"safe\" backend), or fix the"
+ << " error some other way.\n";
}
return false;
}
sys::Path(Output.toString()),
AbsTolerance, RelTolerance, &Error)) {
if (Diff == 2) {
- std::cerr << "While diffing output: " << Error << '\n';
+ errs() << "While diffing output: " << Error << '\n';
exit(1);
}
FilesDifferent = true;
Module *New = runPassesOn(M, CleanupPasses);
if (New == 0) {
- std::cerr << "Final cleanups failed. Sorry. :( Please report a bug!\n";
+ errs() << "Final cleanups failed. Sorry. :( Please report a bug!\n";
return M;
}
delete M;
std::set<Function *> TestFunctions;
for (unsigned i = 0, e = F.size(); i != e; ++i) {
Function *TNOF = cast<Function>(ValueMap[F[i]]);
- DEBUG(std::cerr << "Removing function ");
- DEBUG(WriteAsOperand(std::cerr, TNOF, false));
- DEBUG(std::cerr << "\n");
+ DEBUG(errs() << "Removing function ");
+ DEBUG(WriteAsOperand(errs(), TNOF, false));
+ DEBUG(errs() << "\n");
TestFunctions.insert(cast<Function>(NewValueMap[TNOF]));
DeleteFunctionBody(TNOF); // Function is now external in this module!
}
std::string ErrMsg;
if (uniqueFilename.createTemporaryFileOnDisk(true, &ErrMsg)) {
std::cout << "*** Basic Block extraction failed!\n";
- std::cerr << "Error creating temporary file: " << ErrMsg << "\n";
+ errs() << "Error creating temporary file: " << ErrMsg << "\n";
M = swapProgramIn(M);
EmitProgressBitcode("basicblockextractfail", true);
swapProgramIn(M);
std::ofstream BlocksToNotExtractFile(uniqueFilename.c_str());
if (!BlocksToNotExtractFile) {
std::cout << "*** Basic Block extraction failed!\n";
- std::cerr << "Error writing list of blocks to not extract: " << ErrMsg
- << "\n";
+ errs() << "Error writing list of blocks to not extract: " << ErrMsg
+ << "\n";
M = swapProgramIn(M);
EmitProgressBitcode("basicblockextractfail", true);
swapProgramIn(M);
std::cout << "\n*** diff'd output matches!\n";
}
} catch (ToolExecutionError &TEE) {
- std::cerr << TEE.what();
+ errs() << TEE.what();
debugCodeGeneratorCrash();
return true;
}
#ifndef BUGPOINT_LIST_REDUCER_H
#define BUGPOINT_LIST_REDUCER_H
+#include "llvm/Support/raw_ostream.h"
#include <vector>
-#include <iostream>
#include <cstdlib>
#include <algorithm>
case KeepSuffix:
// cannot be reached!
- std::cerr << "bugpoint ListReducer internal error: selected empty set.\n";
+ errs() << "bugpoint ListReducer internal error: selected empty set.\n";
abort();
case NoFailure:
while (MidTop > 1) { // Binary split reduction loop
// Halt if the user presses ctrl-c.
if (BugpointIsInterrupted) {
- std::cerr << "\n\n*** Reduction Interrupted, cleaning up...\n\n";
+ errs() << "\n\n*** Reduction Interrupted, cleaning up...\n\n";
return true;
}
NumOfIterationsWithoutProgress > MaxIterations) {
std::vector<ElTy> ShuffledList(TheList);
std::random_shuffle(ShuffledList.begin(), ShuffledList.end());
- std::cerr << "\n\n*** Testing shuffled set...\n\n";
+ errs() << "\n\n*** Testing shuffled set...\n\n";
// Check that random shuffle doesn't loose the bug
if (doTest(ShuffledList, empty) == KeepPrefix) {
// If the bug is still here, use the shuffled list.
// Must increase the shuffling treshold to avoid the small
// probability of inifinite looping without making progress.
MaxIterations += 2;
- std::cerr << "\n\n*** Shuffling does not hide the bug...\n\n";
+ errs() << "\n\n*** Shuffling does not hide the bug...\n\n";
} else {
ShufflingEnabled = false; // Disable shuffling further on
- std::cerr << "\n\n*** Shuffling hides the bug...\n\n";
+ errs() << "\n\n*** Shuffling hides the bug...\n\n";
}
NumOfIterationsWithoutProgress = 0;
}
for (unsigned i = 1; i < TheList.size()-1; ++i) { // Check interior elts
if (BugpointIsInterrupted) {
- std::cerr << "\n\n*** Reduction Interrupted, cleaning up...\n\n";
+ errs() << "\n\n*** Reduction Interrupted, cleaning up...\n\n";
return true;
}
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileUtilities.h"
#include "llvm/Config/config.h" // for HAVE_LINK_R
+#include <iostream>
using namespace llvm;
namespace llvm {
std::string BitcodeResult;
if (BD.runPasses(Suffix, BitcodeResult, false/*delete*/, true/*quiet*/)) {
- std::cerr << " Error running this sequence of passes"
- << " on the input program!\n";
+ errs() << " Error running this sequence of passes"
+ << " on the input program!\n";
BD.setPassesToRun(Suffix);
BD.EmitProgressBitcode("pass-error", false);
exit(BD.debugOptimizerCrash());
if (BD.diffProgram(BitcodeResult, "", true /*delete bitcode*/)) {
std::cout << " nope.\n";
if (Suffix.empty()) {
- std::cerr << BD.getToolName() << ": I'm confused: the test fails when "
- << "no passes are run, nondeterministic program?\n";
+ errs() << BD.getToolName() << ": I'm confused: the test fails when "
+ << "no passes are run, nondeterministic program?\n";
exit(1);
}
return KeepSuffix; // Miscompilation detected!
// prefix passes, then discard the prefix passes.
//
if (BD.runPasses(Prefix, BitcodeResult, false/*delete*/, true/*quiet*/)) {
- std::cerr << " Error running this sequence of passes"
- << " on the input program!\n";
+ errs() << " Error running this sequence of passes"
+ << " on the input program!\n";
BD.setPassesToRun(Prefix);
BD.EmitProgressBitcode("pass-error", false);
exit(BD.debugOptimizerCrash());
//
Module *PrefixOutput = ParseInputFile(BitcodeResult, BD.getContext());
if (PrefixOutput == 0) {
- std::cerr << BD.getToolName() << ": Error reading bitcode file '"
- << BitcodeResult << "'!\n";
+ errs() << BD.getToolName() << ": Error reading bitcode file '"
+ << BitcodeResult << "'!\n";
exit(1);
}
sys::Path(BitcodeResult).eraseFromDisk(); // No longer need the file on disk
Module *OriginalInput = BD.swapProgramIn(PrefixOutput);
if (BD.runPasses(Suffix, BitcodeResult, false/*delete*/, true/*quiet*/)) {
- std::cerr << " Error running this sequence of passes"
- << " on the input program!\n";
+ errs() << " Error running this sequence of passes"
+ << " on the input program!\n";
BD.setPassesToRun(Suffix);
BD.EmitProgressBitcode("pass-error", false);
exit(BD.debugOptimizerCrash());
M2 = CloneModule(M2);
}
if (Linker::LinkModules(M1, M2, &ErrorMsg)) {
- std::cerr << BD.getToolName() << ": Error linking modules together:"
- << ErrorMsg << '\n';
+ errs() << BD.getToolName() << ": Error linking modules together:"
+ << ErrorMsg << '\n';
exit(1);
}
delete M2; // We are done with this module.
return MadeChange;
}
- std::cerr << "Extracted a loop from the breaking portion of the program.\n";
+ errs() << "Extracted a loop from the breaking portion of the program.\n";
// Bugpoint is intentionally not very trusting of LLVM transformations. In
// particular, we're not going to assume that the loop extractor works, so
BD.switchToInterpreter(AI);
// Merged program doesn't work anymore!
- std::cerr << " *** ERROR: Loop extraction broke the program. :("
- << " Please report a bug!\n";
- std::cerr << " Continuing on with un-loop-extracted version.\n";
+ errs() << " *** ERROR: Loop extraction broke the program. :("
+ << " Please report a bug!\n";
+ errs() << " Continuing on with un-loop-extracted version.\n";
BD.writeProgramToFile("bugpoint-loop-extract-fail-tno.bc", ToNotOptimize);
BD.writeProgramToFile("bugpoint-loop-extract-fail-to.bc", ToOptimize);
BD.writeProgramToFile("bugpoint-loop-extract-fail-to-le.bc",
ToOptimizeLoopExtracted);
- std::cerr << "Please submit the bugpoint-loop-extract-fail-*.bc files.\n";
+ errs() << "Please submit the bugpoint-loop-extract-fail-*.bc files.\n";
delete ToOptimize;
delete ToNotOptimize;
delete ToOptimizeLoopExtracted;
// extract another loop.
std::string ErrorMsg;
if (Linker::LinkModules(ToNotOptimize, ToOptimizeLoopExtracted, &ErrorMsg)){
- std::cerr << BD.getToolName() << ": Error linking modules together:"
- << ErrorMsg << '\n';
+ errs() << BD.getToolName() << ": Error linking modules together:"
+ << ErrorMsg << '\n';
exit(1);
}
delete ToOptimizeLoopExtracted;
Module *Extracted = BD.ExtractMappedBlocksFromModule(Blocks, ToExtract);
if (Extracted == 0) {
// Weird, extraction should have worked.
- std::cerr << "Nondeterministic problem extracting blocks??\n";
+ errs() << "Nondeterministic problem extracting blocks??\n";
delete ProgClone;
delete ToExtract;
return false;
std::string ErrorMsg;
if (Linker::LinkModules(ProgClone, Extracted, &ErrorMsg)) {
- std::cerr << BD.getToolName() << ": Error linking modules together:"
- << ErrorMsg << '\n';
+ errs() << BD.getToolName() << ": Error linking modules together:"
+ << ErrorMsg << '\n';
exit(1);
}
delete Extracted;
// Make sure something was miscompiled...
if (!BugpointIsInterrupted)
if (!ReduceMiscompilingPasses(*this).reduceList(PassesToRun)) {
- std::cerr << "*** Optimized program matches reference output! No problem"
- << " detected...\nbugpoint can't help you with your problem!\n";
+ errs() << "*** Optimized program matches reference output! No problem"
+ << " detected...\nbugpoint can't help you with your problem!\n";
return false;
}
}
if (verifyModule(*Test) || verifyModule(*Safe)) {
- std::cerr << "Bugpoint has a bug, which corrupted a module!!\n";
+ errs() << "Bugpoint has a bug, which corrupted a module!!\n";
abort();
}
}
sys::Path TestModuleBC("bugpoint.test.bc");
std::string ErrMsg;
if (TestModuleBC.makeUnique(true, &ErrMsg)) {
- std::cerr << BD.getToolName() << "Error making unique filename: "
- << ErrMsg << "\n";
+ errs() << BD.getToolName() << "Error making unique filename: "
+ << ErrMsg << "\n";
exit(1);
}
if (BD.writeProgramToFile(TestModuleBC.toString(), Test)) {
- std::cerr << "Error writing bitcode to `" << TestModuleBC << "'\nExiting.";
+ errs() << "Error writing bitcode to `" << TestModuleBC << "'\nExiting.";
exit(1);
}
delete Test;
// Make the shared library
sys::Path SafeModuleBC("bugpoint.safe.bc");
if (SafeModuleBC.makeUnique(true, &ErrMsg)) {
- std::cerr << BD.getToolName() << "Error making unique filename: "
- << ErrMsg << "\n";
+ errs() << BD.getToolName() << "Error making unique filename: "
+ << ErrMsg << "\n";
exit(1);
}
if (BD.writeProgramToFile(SafeModuleBC.toString(), Safe)) {
- std::cerr << "Error writing bitcode to `" << SafeModuleBC << "'\nExiting.";
+ errs() << "Error writing bitcode to `" << SafeModuleBC << "'\nExiting.";
exit(1);
}
std::string SharedObject = BD.compileSharedObject(SafeModuleBC.toString());
int Result = BD.diffProgram(TestModuleBC.toString(), SharedObject, false);
if (Result)
- std::cerr << ": still failing!\n";
+ errs() << ": still failing!\n";
else
- std::cerr << ": didn't fail.\n";
+ errs() << ": didn't fail.\n";
TestModuleBC.eraseFromDisk();
SafeModuleBC.eraseFromDisk();
sys::Path(SharedObject).eraseFromDisk();
sys::Path TestModuleBC("bugpoint.test.bc");
std::string ErrMsg;
if (TestModuleBC.makeUnique(true, &ErrMsg)) {
- std::cerr << getToolName() << "Error making unique filename: "
- << ErrMsg << "\n";
+ errs() << getToolName() << "Error making unique filename: "
+ << ErrMsg << "\n";
exit(1);
}
if (writeProgramToFile(TestModuleBC.toString(), ToCodeGen)) {
- std::cerr << "Error writing bitcode to `" << TestModuleBC << "'\nExiting.";
+ errs() << "Error writing bitcode to `" << TestModuleBC << "'\nExiting.";
exit(1);
}
delete ToCodeGen;
// Make the shared library
sys::Path SafeModuleBC("bugpoint.safe.bc");
if (SafeModuleBC.makeUnique(true, &ErrMsg)) {
- std::cerr << getToolName() << "Error making unique filename: "
- << ErrMsg << "\n";
+ errs() << getToolName() << "Error making unique filename: "
+ << ErrMsg << "\n";
exit(1);
}
if (writeProgramToFile(SafeModuleBC.toString(), ToNotCodeGen)) {
- std::cerr << "Error writing bitcode to `" << SafeModuleBC << "'\nExiting.";
+ errs() << "Error writing bitcode to `" << SafeModuleBC << "'\nExiting.";
exit(1);
}
std::string SharedObject = compileSharedObject(SafeModuleBC.toString());
redirects[2] = &StdErrFile;
if (0) {
- std::cerr << "RUN:";
+ errs() << "RUN:";
for (unsigned i = 0; Args[i]; ++i)
- std::cerr << " " << Args[i];
- std::cerr << "\n";
+ errs() << " " << Args[i];
+ errs() << "\n";
}
return
sys::Path ErrorFilename("bugpoint.program_error_messages");
std::string ErrMsg;
if (ErrorFilename.makeUnique(true, &ErrMsg)) {
- std::cerr << "Error making unique filename: " << ErrMsg << "\n";
+ errs() << "Error making unique filename: " << ErrMsg << "\n";
exit(1);
}
RunProgramWithTimeout(ProgPath, Args, sys::Path(""), ErrorFilename,
LLIArgs.push_back(0);
std::cout << "<lli>" << std::flush;
- DEBUG(std::cerr << "\nAbout to run:\t";
+ DEBUG(errs() << "\nAbout to run:\t";
for (unsigned i=0, e = LLIArgs.size()-1; i != e; ++i)
- std::cerr << " " << LLIArgs[i];
- std::cerr << "\n";
+ errs() << " " << LLIArgs[i];
+ errs() << "\n";
);
return RunProgramWithTimeout(sys::Path(LLIPath), &LLIArgs[0],
sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
sys::Path uniqueFile(Bitcode+".llc.s");
std::string ErrMsg;
if (uniqueFile.makeUnique(true, &ErrMsg)) {
- std::cerr << "Error making unique filename: " << ErrMsg << "\n";
+ errs() << "Error making unique filename: " << ErrMsg << "\n";
exit(1);
}
OutputAsmFile = uniqueFile;
LLCArgs.push_back (0);
std::cout << "<llc>" << std::flush;
- DEBUG(std::cerr << "\nAbout to run:\t";
+ DEBUG(errs() << "\nAbout to run:\t";
for (unsigned i=0, e = LLCArgs.size()-1; i != e; ++i)
- std::cerr << " " << LLCArgs[i];
- std::cerr << "\n";
+ errs() << " " << LLCArgs[i];
+ errs() << "\n";
);
if (RunProgramWithTimeout(sys::Path(LLCPath), &LLCArgs[0],
sys::Path(), sys::Path(), sys::Path()))
Message = "Found llc: " + LLCPath + "\n";
GCC *gcc = GCC::create(ProgramPath, Message, GCCArgs);
if (!gcc) {
- std::cerr << Message << "\n";
+ errs() << Message << "\n";
exit(1);
}
return new LLC(LLCPath, gcc, Args, GCCArgs);
JITArgs.push_back(0);
std::cout << "<jit>" << std::flush;
- DEBUG(std::cerr << "\nAbout to run:\t";
+ DEBUG(errs() << "\nAbout to run:\t";
for (unsigned i=0, e = JITArgs.size()-1; i != e; ++i)
- std::cerr << " " << JITArgs[i];
- std::cerr << "\n";
+ errs() << " " << JITArgs[i];
+ errs() << "\n";
);
- DEBUG(std::cerr << "\nSending output to " << OutputFile << "\n");
+ DEBUG(errs() << "\nSending output to " << OutputFile << "\n");
return RunProgramWithTimeout(sys::Path(LLIPath), &JITArgs[0],
sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
Timeout, MemoryLimit);
sys::Path uniqueFile(Bitcode+".cbe.c");
std::string ErrMsg;
if (uniqueFile.makeUnique(true, &ErrMsg)) {
- std::cerr << "Error making unique filename: " << ErrMsg << "\n";
+ errs() << "Error making unique filename: " << ErrMsg << "\n";
exit(1);
}
OutputCFile = uniqueFile;
LLCArgs.push_back (0);
std::cout << "<cbe>" << std::flush;
- DEBUG(std::cerr << "\nAbout to run:\t";
+ DEBUG(errs() << "\nAbout to run:\t";
for (unsigned i=0, e = LLCArgs.size()-1; i != e; ++i)
- std::cerr << " " << LLCArgs[i];
- std::cerr << "\n";
+ errs() << " " << LLCArgs[i];
+ errs() << "\n";
);
if (RunProgramWithTimeout(LLCPath, &LLCArgs[0], sys::Path(), sys::Path(),
sys::Path()))
Message = "Found llc: " + LLCPath.toString() + "\n";
GCC *gcc = GCC::create(ProgramPath, Message, GCCArgs);
if (!gcc) {
- std::cerr << Message << "\n";
+ errs() << Message << "\n";
exit(1);
}
return new CBE(LLCPath, gcc, Args);
sys::Path OutputBinary (ProgramFile+".gcc.exe");
std::string ErrMsg;
if (OutputBinary.makeUnique(true, &ErrMsg)) {
- std::cerr << "Error making unique filename: " << ErrMsg << "\n";
+ errs() << "Error making unique filename: " << ErrMsg << "\n";
exit(1);
}
GCCArgs.push_back(OutputBinary.c_str()); // Output to the right file...
GCCArgs.push_back(0); // NULL terminator
std::cout << "<gcc>" << std::flush;
- DEBUG(std::cerr << "\nAbout to run:\t";
+ DEBUG(errs() << "\nAbout to run:\t";
for (unsigned i=0, e = GCCArgs.size()-1; i != e; ++i)
- std::cerr << " " << GCCArgs[i];
- std::cerr << "\n";
+ errs() << " " << GCCArgs[i];
+ errs() << "\n";
);
if (RunProgramWithTimeout(GCCPath, &GCCArgs[0], sys::Path(), sys::Path(),
sys::Path())) {
// Now that we have a binary, run it!
std::cout << "<program>" << std::flush;
- DEBUG(std::cerr << "\nAbout to run:\t";
+ DEBUG(errs() << "\nAbout to run:\t";
for (unsigned i=0, e = ProgramArgs.size()-1; i != e; ++i)
- std::cerr << " " << ProgramArgs[i];
- std::cerr << "\n";
+ errs() << " " << ProgramArgs[i];
+ errs() << "\n";
);
FileRemover OutputBinaryRemover(OutputBinary);
if (RemoteClientPath.isEmpty()) {
- DEBUG(std::cerr << "<run locally>" << std::flush;);
+ DEBUG(errs() << "<run locally>";);
return RunProgramWithTimeout(OutputBinary, &ProgramArgs[0],
sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
Timeout, MemoryLimit);
&ProgramArgs[0], sys::Path(InputFile), sys::Path(OutputFile),
sys::Path(OutputFile), Timeout, MemoryLimit);
if (RemoteClientStatus != 0) {
- std::cerr << "Remote Client failed with an error: " <<
- RemoteClientStatus << ".\n" << std::flush;
+ errs() << "Remote Client failed with an error: " <<
+ RemoteClientStatus << ".\n";
}
}
sys::Path uniqueFilename(InputFile+LTDL_SHLIB_EXT);
std::string ErrMsg;
if (uniqueFilename.makeUnique(true, &ErrMsg)) {
- std::cerr << "Error making unique filename: " << ErrMsg << "\n";
+ errs() << "Error making unique filename: " << ErrMsg << "\n";
exit(1);
}
OutputFile = uniqueFilename.toString();
std::cout << "<gcc>" << std::flush;
- DEBUG(std::cerr << "\nAbout to run:\t";
+ DEBUG(errs() << "\nAbout to run:\t";
for (unsigned i=0, e = GCCArgs.size()-1; i != e; ++i)
- std::cerr << " " << GCCArgs[i];
- std::cerr << "\n";
+ errs() << " " << GCCArgs[i];
+ errs() << "\n";
);
if (RunProgramWithTimeout(GCCPath, &GCCArgs[0], sys::Path(), sys::Path(),
sys::Path())) {
try {
return D.run();
} catch (ToolExecutionError &TEE) {
- std::cerr << "Tool execution error: " << TEE.what() << '\n';
+ errs() << "Tool execution error: " << TEE.what() << '\n';
} catch (const std::string& msg) {
- std::cerr << argv[0] << ": " << msg << "\n";
+ errs() << argv[0] << ": " << msg << "\n";
} catch (const std::bad_alloc &e) {
- std::cerr << "Oh no, a bugpoint process ran out of memory!\n"
- "To increase the allocation limits for bugpoint child\n"
- "processes, use the -mlimit option.\n";
+ errs() << "Oh no, a bugpoint process ran out of memory!\n"
+ "To increase the allocation limits for bugpoint child\n"
+ "processes, use the -mlimit option.\n";
} catch (const std::exception &e) {
- std::cerr << "Whoops, a std::exception leaked out of bugpoint: "
- << e.what() << "\n"
- << "This is a bug in bugpoint!\n";
+ errs() << "Whoops, a std::exception leaked out of bugpoint: "
+ << e.what() << "\n"
+ << "This is a bug in bugpoint!\n";
} catch (...) {
- std::cerr << "Whoops, an exception leaked out of bugpoint. "
- << "This is a bug in bugpoint!\n";
+ errs() << "Whoops, an exception leaked out of bugpoint. "
+ << "This is a bug in bugpoint!\n";
}
return 1;
}
// Specified an output filename?
if (!Force && std::ifstream(OutputFilename.c_str())) {
// If force is not specified, make sure not to overwrite a file!
- std::cerr << ProgName << ": error opening '" << OutputFilename
- << "': file exists!\n"
- << "Use -f command line argument to force output\n";
+ errs() << ProgName << ": error opening '" << OutputFilename
+ << "': file exists!\n"
+ << "Use -f command line argument to force output\n";
return 0;
}
// Make sure that the Out file gets unlinked from the disk if we get a
formatted_raw_ostream *Out =
new formatted_raw_ostream(*FDOut, formatted_raw_ostream::DELETE_STREAM);
if (!error.empty()) {
- std::cerr << error << '\n';
+ errs() << error << '\n';
delete Out;
return 0;
}
if (!Force && std::ifstream(OutputFilename.c_str())) {
// If force is not specified, make sure not to overwrite a file!
- std::cerr << ProgName << ": error opening '" << OutputFilename
- << "': file exists!\n"
- << "Use -f command line argument to force output\n";
+ errs() << ProgName << ": error opening '" << OutputFilename
+ << "': file exists!\n"
+ << "Use -f command line argument to force output\n";
return 0;
}
formatted_raw_ostream *Out =
new formatted_raw_ostream(*FDOut, formatted_raw_ostream::DELETE_STREAM);
if (!error.empty()) {
- std::cerr << error << '\n';
+ errs() << error << '\n';
delete Out;
return 0;
}
if (Buffer.get())
M.reset(ParseBitcodeFile(Buffer.get(), Context, &ErrorMessage));
if (M.get() == 0) {
- std::cerr << argv[0] << ": bitcode didn't read correctly.\n";
- std::cerr << "Reason: " << ErrorMessage << "\n";
+ errs() << argv[0] << ": bitcode didn't read correctly.\n";
+ errs() << "Reason: " << ErrorMessage << "\n";
return 1;
}
Module &mod = *M.get();
std::string Err;
TheTarget = TargetRegistry::getClosestStaticTargetForModule(mod, Err);
if (TheTarget == 0) {
- std::cerr << argv[0] << ": error auto-selecting target for module '"
- << Err << "'. Please use the -march option to explicitly "
- << "pick a target.\n";
+ errs() << argv[0] << ": error auto-selecting target for module '"
+ << Err << "'. Please use the -march option to explicitly "
+ << "pick a target.\n";
return 1;
}
}
CodeGenOpt::Level OLvl = CodeGenOpt::Default;
switch (OptLevel) {
default:
- std::cerr << argv[0] << ": invalid optimization level.\n";
+ errs() << argv[0] << ": invalid optimization level.\n";
return 1;
case ' ': break;
case '0': OLvl = CodeGenOpt::None; break;
// Ask the target to add backend passes as necessary.
if (Target.addPassesToEmitWholeFile(PM, *Out, FileType, OLvl)) {
- std::cerr << argv[0] << ": target does not support generation of this"
- << " file type!\n";
+ errs() << argv[0] << ": target does not support generation of this"
+ << " file type!\n";
if (Out != &fouts()) delete Out;
// And the Out file is empty and useless, so remove it now.
sys::Path(OutputFilename).eraseFromDisk();
assert(0 && "Invalid file model!");
return 1;
case FileModel::Error:
- std::cerr << argv[0] << ": target does not support generation of this"
- << " file type!\n";
+ errs() << argv[0] << ": target does not support generation of this"
+ << " file type!\n";
if (Out != &fouts()) delete Out;
// And the Out file is empty and useless, so remove it now.
sys::Path(OutputFilename).eraseFromDisk();
}
if (Target.addPassesToEmitFileFinish(Passes, OCE, OLvl)) {
- std::cerr << argv[0] << ": target does not support generation of this"
- << " file type!\n";
+ errs() << argv[0] << ": target does not support generation of this"
+ << " file type!\n";
if (Out != &fouts()) delete Out;
// And the Out file is empty and useless, so remove it now.
sys::Path(OutputFilename).eraseFromDisk();
}
if (!MP) {
- std::cerr << argv[0] << ": error loading program '" << InputFile << "': "
- << ErrorMsg << "\n";
+ errs() << argv[0] << ": error loading program '" << InputFile << "': "
+ << ErrorMsg << "\n";
exit(1);
}
Module *Mod = NoLazyCompilation
? MP->materializeModule(&ErrorMsg) : MP->getModule();
if (!Mod) {
- std::cerr << argv[0] << ": bitcode didn't read correctly.\n";
- std::cerr << "Reason: " << ErrorMsg << "\n";
+ errs() << argv[0] << ": bitcode didn't read correctly.\n";
+ errs() << "Reason: " << ErrorMsg << "\n";
exit(1);
}
CodeGenOpt::Level OLvl = CodeGenOpt::Default;
switch (OptLevel) {
default:
- std::cerr << argv[0] << ": invalid optimization level.\n";
+ errs() << argv[0] << ": invalid optimization level.\n";
return 1;
case ' ': break;
case '0': OLvl = CodeGenOpt::None; break;
EE = ExecutionEngine::create(MP, ForceInterpreter, &ErrorMsg, OLvl);
if (!EE) {
if (!ErrorMsg.empty())
- std::cerr << argv[0] << ": error creating EE: " << ErrorMsg << "\n";
+ errs() << argv[0] << ": error creating EE: " << ErrorMsg << "\n";
else
- std::cerr << argv[0] << ": unknown error creating EE!\n";
+ errs() << argv[0] << ": unknown error creating EE!\n";
exit(1);
}
//
Function *EntryFn = Mod->getFunction(EntryFunc);
if (!EntryFn) {
- std::cerr << '\'' << EntryFunc << "\' function not found in module.\n";
+ errs() << '\'' << EntryFunc << "\' function not found in module.\n";
return -1;
}
ResultGV.IntVal = APInt(32, Result);
Args.push_back(ResultGV);
EE->runFunction(ExitF, Args);
- std::cerr << "ERROR: exit(" << Result << ") returned!\n";
+ errs() << "ERROR: exit(" << Result << ") returned!\n";
abort();
} else {
- std::cerr << "ERROR: exit defined with wrong prototype!\n";
+ errs() << "ERROR: exit defined with wrong prototype!\n";
abort();
}
}
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Signals.h"
#include <iostream>
#include <algorithm>
if (!ArchivePath.exists()) {
// Produce a warning if we should and we're creating the archive
if (!Create)
- std::cerr << argv[0] << ": creating " << ArchivePath.toString() << "\n";
+ errs() << argv[0] << ": creating " << ArchivePath.toString() << "\n";
TheArchive = Archive::CreateEmpty(ArchivePath, Context);
TheArchive->writeToDisk();
} else {
std::string Error;
TheArchive = Archive::OpenAndLoad(ArchivePath, Context, &Error);
if (TheArchive == 0) {
- std::cerr << argv[0] << ": error loading '" << ArchivePath << "': "
- << Error << "!\n";
+ errs() << argv[0] << ": error loading '" << ArchivePath << "': "
+ << Error << "!\n";
return 1;
}
}
case DisplayTable: haveError = doDisplayTable(&ErrMsg); break;
case Extract: haveError = doExtract(&ErrMsg); break;
case NoOperation:
- std::cerr << argv[0] << ": No operation was selected.\n";
+ errs() << argv[0] << ": No operation was selected.\n";
break;
}
if (haveError) {
- std::cerr << argv[0] << ": " << ErrMsg << "\n";
+ errs() << argv[0] << ": " << ErrMsg << "\n";
return 1;
}
} catch (const char*msg) {
// These errors are usage errors, thrown only by the various checks in the
// code above.
- std::cerr << argv[0] << ": " << msg << "\n\n";
+ errs() << argv[0] << ": " << msg << "\n\n";
cl::PrintHelpMessage();
exitCode = 1;
} catch (const std::string& msg) {
// These errors are thrown by LLVM libraries (e.g. lib System) and represent
// a more serious error so we bump the exitCode and don't print the usage.
- std::cerr << argv[0] << ": " << msg << "\n";
+ errs() << argv[0] << ": " << msg << "\n";
exitCode = 2;
} catch (...) {
// This really shouldn't happen, but just in case ....
- std::cerr << argv[0] << ": An unexpected unknown exception occurred.\n";
+ errs() << argv[0] << ": An unexpected unknown exception occurred.\n";
exitCode = 3;
}
/// Error - All bitcode analysis errors go through this function, making this a
/// good place to breakpoint if debugging.
static bool Error(const std::string &Err) {
- std::cerr << Err << "\n";
+ errs() << Err << "\n";
return true;
}
// BLOCKINFO is a special part of the stream.
if (BlockID == bitc::BLOCKINFO_BLOCK_ID) {
- if (Dump) std::cerr << Indent << "<BLOCKINFO_BLOCK/>\n";
+ if (Dump) errs() << Indent << "<BLOCKINFO_BLOCK/>\n";
if (Stream.ReadBlockInfoBlock())
return Error("Malformed BlockInfoBlock");
uint64_t BlockBitEnd = Stream.GetCurrentBitNo();
const char *BlockName = 0;
if (Dump) {
- std::cerr << Indent << "<";
+ errs() << Indent << "<";
if ((BlockName = GetBlockName(BlockID, *Stream.getBitStreamReader())))
- std::cerr << BlockName;
+ errs() << BlockName;
else
- std::cerr << "UnknownBlock" << BlockID;
+ errs() << "UnknownBlock" << BlockID;
if (NonSymbolic && BlockName)
- std::cerr << " BlockID=" << BlockID;
+ errs() << " BlockID=" << BlockID;
- std::cerr << " NumWords=" << NumWords
- << " BlockCodeSize=" << Stream.GetAbbrevIDWidth() << ">\n";
+ errs() << " NumWords=" << NumWords
+ << " BlockCodeSize=" << Stream.GetAbbrevIDWidth() << ">\n";
}
SmallVector<uint64_t, 64> Record;
uint64_t BlockBitEnd = Stream.GetCurrentBitNo();
BlockStats.NumBits += BlockBitEnd-BlockBitStart;
if (Dump) {
- std::cerr << Indent << "</";
+ errs() << Indent << "</";
if (BlockName)
- std::cerr << BlockName << ">\n";
+ errs() << BlockName << ">\n";
else
- std::cerr << "UnknownBlock" << BlockID << ">\n";
+ errs() << "UnknownBlock" << BlockID << ">\n";
}
return false;
}
BlockStats.CodeFreq[Code].NumAbbrev++;
if (Dump) {
- std::cerr << Indent << " <";
+ errs() << Indent << " <";
if (const char *CodeName =
GetCodeName(Code, BlockID, *Stream.getBitStreamReader()))
- std::cerr << CodeName;
+ errs() << CodeName;
else
- std::cerr << "UnknownCode" << Code;
+ errs() << "UnknownCode" << Code;
if (NonSymbolic &&
GetCodeName(Code, BlockID, *Stream.getBitStreamReader()))
- std::cerr << " codeid=" << Code;
+ errs() << " codeid=" << Code;
if (AbbrevID != bitc::UNABBREV_RECORD)
- std::cerr << " abbrevid=" << AbbrevID;
+ errs() << " abbrevid=" << AbbrevID;
for (unsigned i = 0, e = Record.size(); i != e; ++i)
- std::cerr << " op" << i << "=" << (int64_t)Record[i];
+ errs() << " op" << i << "=" << (int64_t)Record[i];
- std::cerr << "/>";
+ errs() << "/>";
if (BlobStart) {
- std::cerr << " blob data = ";
+ errs() << " blob data = ";
bool BlobIsPrintable = true;
for (unsigned i = 0; i != BlobLen; ++i)
if (!isprint(BlobStart[i])) {
}
if (BlobIsPrintable)
- std::cerr << "'" << std::string(BlobStart, BlobStart+BlobLen) <<"'";
+ errs() << "'" << std::string(BlobStart, BlobStart+BlobLen) <<"'";
else
- std::cerr << "unprintable, " << BlobLen << " bytes.";
+ errs() << "unprintable, " << BlobLen << " bytes.";
}
- std::cerr << "\n";
+ errs() << "\n";
}
break;
++NumTopBlocks;
}
- if (Dump) std::cerr << "\n\n";
+ if (Dump) errs() << "\n\n";
uint64_t BufferSizeBits = (EndBufPtr-BufPtr)*CHAR_BIT;
// Print a summary of the read file.
- std::cerr << "Summary of " << InputFilename << ":\n";
- std::cerr << " Total size: ";
+ errs() << "Summary of " << InputFilename << ":\n";
+ errs() << " Total size: ";
PrintSize(BufferSizeBits);
- std::cerr << "\n";
- std::cerr << " Stream type: ";
+ errs() << "\n";
+ errs() << " Stream type: ";
switch (CurStreamType) {
default: assert(0 && "Unknown bitstream type");
- case UnknownBitstream: std::cerr << "unknown\n"; break;
- case LLVMIRBitstream: std::cerr << "LLVM IR\n"; break;
+ case UnknownBitstream: errs() << "unknown\n"; break;
+ case LLVMIRBitstream: errs() << "LLVM IR\n"; break;
}
- std::cerr << " # Toplevel Blocks: " << NumTopBlocks << "\n";
- std::cerr << "\n";
+ errs() << " # Toplevel Blocks: " << NumTopBlocks << "\n";
+ errs() << "\n";
// Emit per-block stats.
- std::cerr << "Per-block Summary:\n";
+ errs() << "Per-block Summary:\n";
for (std::map<unsigned, PerBlockIDStats>::iterator I = BlockIDStats.begin(),
E = BlockIDStats.end(); I != E; ++I) {
- std::cerr << " Block ID #" << I->first;
+ errs() << " Block ID #" << I->first;
if (const char *BlockName = GetBlockName(I->first, StreamFile))
- std::cerr << " (" << BlockName << ")";
- std::cerr << ":\n";
+ errs() << " (" << BlockName << ")";
+ errs() << ":\n";
const PerBlockIDStats &Stats = I->second;
- std::cerr << " Num Instances: " << Stats.NumInstances << "\n";
- std::cerr << " Total Size: ";
+ errs() << " Num Instances: " << Stats.NumInstances << "\n";
+ errs() << " Total Size: ";
PrintSize(Stats.NumBits);
- std::cerr << "\n";
- std::cerr << " % of file: "
- << Stats.NumBits/(double)BufferSizeBits*100 << "\n";
+ errs() << "\n";
+ errs() << " % of file: "
+ << Stats.NumBits/(double)BufferSizeBits*100 << "\n";
if (Stats.NumInstances > 1) {
- std::cerr << " Average Size: ";
+ errs() << " Average Size: ";
PrintSize(Stats.NumBits/(double)Stats.NumInstances);
- std::cerr << "\n";
- std::cerr << " Tot/Avg SubBlocks: " << Stats.NumSubBlocks << "/"
- << Stats.NumSubBlocks/(double)Stats.NumInstances << "\n";
- std::cerr << " Tot/Avg Abbrevs: " << Stats.NumAbbrevs << "/"
- << Stats.NumAbbrevs/(double)Stats.NumInstances << "\n";
- std::cerr << " Tot/Avg Records: " << Stats.NumRecords << "/"
- << Stats.NumRecords/(double)Stats.NumInstances << "\n";
+ errs() << "\n";
+ errs() << " Tot/Avg SubBlocks: " << Stats.NumSubBlocks << "/"
+ << Stats.NumSubBlocks/(double)Stats.NumInstances << "\n";
+ errs() << " Tot/Avg Abbrevs: " << Stats.NumAbbrevs << "/"
+ << Stats.NumAbbrevs/(double)Stats.NumInstances << "\n";
+ errs() << " Tot/Avg Records: " << Stats.NumRecords << "/"
+ << Stats.NumRecords/(double)Stats.NumInstances << "\n";
} else {
- std::cerr << " Num SubBlocks: " << Stats.NumSubBlocks << "\n";
- std::cerr << " Num Abbrevs: " << Stats.NumAbbrevs << "\n";
- std::cerr << " Num Records: " << Stats.NumRecords << "\n";
+ errs() << " Num SubBlocks: " << Stats.NumSubBlocks << "\n";
+ errs() << " Num Abbrevs: " << Stats.NumAbbrevs << "\n";
+ errs() << " Num Records: " << Stats.NumRecords << "\n";
}
if (Stats.NumRecords)
- std::cerr << " % Abbrev Recs: " << (Stats.NumAbbreviatedRecords/
- (double)Stats.NumRecords)*100 << "\n";
- std::cerr << "\n";
+ errs() << " % Abbrev Recs: " << (Stats.NumAbbreviatedRecords/
+ (double)Stats.NumRecords)*100 << "\n";
+ errs() << "\n";
// Print a histogram of the codes we see.
if (!NoHistogram && !Stats.CodeFreq.empty()) {
std::stable_sort(FreqPairs.begin(), FreqPairs.end());
std::reverse(FreqPairs.begin(), FreqPairs.end());
- std::cerr << "\tRecord Histogram:\n";
+ errs() << "\tRecord Histogram:\n";
fprintf(stderr, "\t\t Count # Bits %% Abv Record Kind\n");
for (unsigned i = 0, e = FreqPairs.size(); i != e; ++i) {
const PerRecordStats &RecStats = Stats.CodeFreq[FreqPairs[i].second];
else
fprintf(stderr, "UnknownCode%d\n", FreqPairs[i].second);
}
- std::cerr << "\n";
+ errs() << "\n";
}
}
if (File == 0)
throw "Unknown file to place breakpoint!";
- std::cerr << "Break: " << File->getFilename() << ":" << LineNo << "\n";
+ errs() << "Break: " << File->getFilename() << ":" << LineNo << "\n";
throw "breakpoints not implemented yet!";
}
// Now that we have initialized the debugger, run it.
return D.run();
} catch (const std::string& msg) {
- std::cerr << argv[0] << ": " << msg << "\n";
+ errs() << argv[0] << ": " << msg << "\n";
} catch (...) {
- std::cerr << argv[0] << ": Unexpected unknown exception occurred.\n";
+ errs() << argv[0] << ": Unexpected unknown exception occurred.\n";
}
return 1;
}
#include "llvm/Analysis/Verifier.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/StandardPasses.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/System/DynamicLibrary.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetMachine.h"
if (Opt->getNormalCtor())
addPass(Passes, Opt->getNormalCtor()());
else
- std::cerr << "llvm-ld: cannot create pass: " << Opt->getPassName()
- << "\n";
+ errs() << "llvm-ld: cannot create pass: " << Opt->getPassName()
+ << "\n";
}
// The user's passes may leave cruft around. Clean up after them them but
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Signals.h"
#include <algorithm>
#include <cctype>
if (Result)
DumpSymbolNamesFromModule(Result);
else {
- std::cerr << ToolName << ": " << Filename << ": " << ErrorMessage << "\n";
+ errs() << ToolName << ": " << Filename << ": " << ErrorMessage << "\n";
return;
}
Archive* archive = Archive::OpenAndLoad(sys::Path(Filename), Context,
&ErrorMessage);
if (!archive)
- std::cerr << ToolName << ": " << Filename << ": " << ErrorMessage << "\n";
+ errs() << ToolName << ": " << Filename << ": " << ErrorMessage << "\n";
std::vector<Module *> Modules;
if (archive->getAllModules(Modules, &ErrorMessage)) {
- std::cerr << ToolName << ": " << Filename << ": " << ErrorMessage << "\n";
+ errs() << ToolName << ": " << Filename << ": " << ErrorMessage << "\n";
return;
}
MultipleFiles = true;
std::for_each (Modules.begin(), Modules.end(), DumpSymbolNamesFromModule);
} else {
- std::cerr << ToolName << ": " << Filename << ": "
- << "unrecognizable file type\n";
+ errs() << ToolName << ": " << Filename << ": "
+ << "unrecognizable file type\n";
return;
}
}
delete Buffer;
}
if (M == 0) {
- std::cerr << argv[0] << ": " << BitcodeFile << ": "
+ errs() << argv[0] << ": " << BitcodeFile << ": "
<< ErrorMessage << "\n";
return 1;
}
return 0;
} catch (const std::string& msg) {
- std::cerr << argv[0] << ": " << msg << "\n";
+ errs() << argv[0] << ": " << msg << "\n";
} catch (...) {
- std::cerr << argv[0] << ": Unexpected unknown exception occurred.\n";
+ errs() << argv[0] << ": Unexpected unknown exception occurred.\n";
}
return 1;
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Signals.h"
#include <iostream>
#include <iomanip>
printSymbolTable(TheArchive);
} catch (const char* msg) {
- std::cerr << argv[0] << ": " << msg << "\n\n";
+ errs() << argv[0] << ": " << msg << "\n\n";
exitCode = 1;
} catch (const std::string& msg) {
- std::cerr << argv[0] << ": " << msg << "\n";
+ errs() << argv[0] << ": " << msg << "\n";
exitCode = 2;
} catch (...) {
- std::cerr << argv[0] << ": An unexpected unknown exception occurred.\n";
+ errs() << argv[0] << ": An unexpected unknown exception occurred.\n";
exitCode = 3;
}
return exitCode;
#include "llvm/Pass.h"
#include "llvm/Support/CallSite.h"
#include "llvm/Analysis/CallGraph.h"
+#include "llvm/Support/raw_ostream.h"
#include <iostream>
using namespace llvm;
E = CS.arg_end(); AI != E; ++AI)
if (isa<Constant>(*AI)) {
if (!PrintedFn) {
- std::cerr << "Function '" << I->getName() << "':\n";
+ errs() << "Function '" << I->getName() << "':\n";
PrintedFn = true;
}
- std::cerr << *User;
+ errs() << *User;
break;
}
}