summaryrefslogtreecommitdiff
path: root/tools/bugpoint
diff options
context:
space:
mode:
Diffstat (limited to 'tools/bugpoint')
-rw-r--r--tools/bugpoint/BugDriver.cpp8
-rw-r--r--tools/bugpoint/CrashDebugger.cpp8
-rw-r--r--tools/bugpoint/ExecutionDriver.cpp8
-rw-r--r--tools/bugpoint/ExtractFunction.cpp22
-rw-r--r--tools/bugpoint/FindBugs.cpp2
-rw-r--r--tools/bugpoint/Miscompilation.cpp6
-rw-r--r--tools/bugpoint/OptimizerDriver.cpp14
-rw-r--r--tools/bugpoint/ToolRunner.cpp34
-rw-r--r--tools/bugpoint/bugpoint.cpp2
9 files changed, 52 insertions, 52 deletions
diff --git a/tools/bugpoint/BugDriver.cpp b/tools/bugpoint/BugDriver.cpp
index 2d1b903829..043863a354 100644
--- a/tools/bugpoint/BugDriver.cpp
+++ b/tools/bugpoint/BugDriver.cpp
@@ -70,8 +70,8 @@ BugDriver::BugDriver(const char *toolname, bool find_bugs,
unsigned timeout, unsigned memlimit, bool use_valgrind,
LLVMContext& ctxt)
: Context(ctxt), ToolName(toolname), ReferenceOutputFile(OutputFile),
- Program(0), Interpreter(0), SafeInterpreter(0), gcc(0),
- run_find_bugs(find_bugs), Timeout(timeout),
+ Program(nullptr), Interpreter(nullptr), SafeInterpreter(nullptr),
+ gcc(nullptr), run_find_bugs(find_bugs), Timeout(timeout),
MemoryLimit(memlimit), UseValgrind(use_valgrind) {}
BugDriver::~BugDriver() {
@@ -117,13 +117,13 @@ bool BugDriver::addSources(const std::vector<std::string> &Filenames) {
// Load the first input file.
Program = ParseInputFile(Filenames[0], Context);
- if (Program == 0) return true;
+ if (!Program) return true;
outs() << "Read input file : '" << Filenames[0] << "'\n";
for (unsigned i = 1, e = Filenames.size(); i != e; ++i) {
std::unique_ptr<Module> M(ParseInputFile(Filenames[i], Context));
- if (M.get() == 0) return true;
+ if (!M.get()) return true;
outs() << "Linking in input file: '" << Filenames[i] << "'\n";
std::string ErrorMessage;
diff --git a/tools/bugpoint/CrashDebugger.cpp b/tools/bugpoint/CrashDebugger.cpp
index c646ff49b1..8bd61b3c09 100644
--- a/tools/bugpoint/CrashDebugger.cpp
+++ b/tools/bugpoint/CrashDebugger.cpp
@@ -63,7 +63,7 @@ ReducePassList::doTest(std::vector<std::string> &Prefix,
std::vector<std::string> &Suffix,
std::string &Error) {
std::string PrefixOutput;
- Module *OrigProgram = 0;
+ Module *OrigProgram = nullptr;
if (!Prefix.empty()) {
outs() << "Checking to see if these passes crash: "
<< getPassesString(Prefix) << ": ";
@@ -73,7 +73,7 @@ ReducePassList::doTest(std::vector<std::string> &Prefix,
OrigProgram = BD.Program;
BD.Program = ParseInputFile(PrefixOutput, BD.getContext());
- if (BD.Program == 0) {
+ if (BD.Program == nullptr) {
errs() << BD.getToolName() << ": Error reading bitcode file '"
<< PrefixOutput << "'!\n";
exit(1);
@@ -149,7 +149,7 @@ ReduceCrashingGlobalVariables::TestGlobalVariables(
for (Module::global_iterator I = M->global_begin(), E = M->global_end();
I != E; ++I)
if (I->hasInitializer() && !GVSet.count(I)) {
- I->setInitializer(0);
+ I->setInitializer(nullptr);
I->setLinkage(GlobalValue::ExternalLinkage);
}
@@ -447,7 +447,7 @@ static bool DebugACrash(BugDriver &BD,
for (Module::global_iterator I = M->global_begin(), E = M->global_end();
I != E; ++I)
if (I->hasInitializer()) {
- I->setInitializer(0);
+ I->setInitializer(nullptr);
I->setLinkage(GlobalValue::ExternalLinkage);
DeletedInit = true;
}
diff --git a/tools/bugpoint/ExecutionDriver.cpp b/tools/bugpoint/ExecutionDriver.cpp
index 609de03db8..5ed7d2cab3 100644
--- a/tools/bugpoint/ExecutionDriver.cpp
+++ b/tools/bugpoint/ExecutionDriver.cpp
@@ -145,7 +145,7 @@ bool BugDriver::initializeExecutionEnvironment() {
// Create an instance of the AbstractInterpreter interface as specified on
// the command line
- SafeInterpreter = 0;
+ SafeInterpreter = nullptr;
std::string Message;
switch (InterpreterSel) {
@@ -256,7 +256,7 @@ bool BugDriver::initializeExecutionEnvironment() {
if (!gcc) { outs() << Message << "\nExiting.\n"; exit(1); }
// If there was an error creating the selected interpreter, quit with error.
- return Interpreter == 0;
+ return Interpreter == nullptr;
}
/// compileProgram - Try to compile the specified module, returning false and
@@ -298,7 +298,7 @@ std::string BugDriver::executeProgram(const Module *Program,
const std::string &SharedObj,
AbstractInterpreter *AI,
std::string *Error) const {
- if (AI == 0) AI = Interpreter;
+ if (!AI) AI = Interpreter;
assert(AI && "Interpreter should have been created already!");
bool CreatedBitcode = false;
if (BitcodeFile.empty()) {
@@ -445,7 +445,7 @@ bool BugDriver::diffProgram(const Module *Program,
std::string *ErrMsg) const {
// Execute the program, generating an output file...
std::string Output(
- executeProgram(Program, "", BitcodeFile, SharedObject, 0, ErrMsg));
+ executeProgram(Program, "", BitcodeFile, SharedObject, nullptr, ErrMsg));
if (!ErrMsg->empty())
return false;
diff --git a/tools/bugpoint/ExtractFunction.cpp b/tools/bugpoint/ExtractFunction.cpp
index d1b1aff778..38cdf241ce 100644
--- a/tools/bugpoint/ExtractFunction.cpp
+++ b/tools/bugpoint/ExtractFunction.cpp
@@ -51,7 +51,7 @@ namespace {
Function* globalInitUsesExternalBA(GlobalVariable* GV) {
if (!GV->hasInitializer())
- return 0;
+ return nullptr;
Constant *I = GV->getInitializer();
@@ -78,7 +78,7 @@ namespace {
Todo.push_back(C);
}
}
- return 0;
+ return nullptr;
}
} // end anonymous namespace
@@ -150,7 +150,7 @@ Module *BugDriver::performFinalCleanups(Module *M, bool MayModifySemantics) {
CleanupPasses.push_back("deadargelim");
Module *New = runPassesOn(M, CleanupPasses);
- if (New == 0) {
+ if (!New) {
errs() << "Final cleanups failed. Sorry. :( Please report a bug!\n";
return M;
}
@@ -167,11 +167,11 @@ Module *BugDriver::ExtractLoop(Module *M) {
LoopExtractPasses.push_back("loop-extract-single");
Module *NewM = runPassesOn(M, LoopExtractPasses);
- if (NewM == 0) {
+ if (!NewM) {
outs() << "*** Loop extraction failed: ";
EmitProgressBitcode(M, "loopextraction", true);
outs() << "*** Sorry. :( Please report a bug!\n";
- return 0;
+ return nullptr;
}
// Check to see if we created any new functions. If not, no loops were
@@ -180,7 +180,7 @@ Module *BugDriver::ExtractLoop(Module *M) {
static unsigned NumExtracted = 32;
if (M->size() == NewM->size() || --NumExtracted == 0) {
delete NewM;
- return 0;
+ return nullptr;
} else {
assert(M->size() < NewM->size() && "Loop extract removed functions?");
Module::iterator MI = NewM->begin();
@@ -337,10 +337,10 @@ llvm::SplitFunctionsOutOfModule(Module *M,
<< "' and from test function '" << TestFn->getName() << "'.\n";
exit(1);
}
- I->setInitializer(0); // Delete the initializer to make it external
+ I->setInitializer(nullptr); // Delete the initializer to make it external
} else {
// If we keep it in the safe module, then delete it in the test module
- GV->setInitializer(0);
+ GV->setInitializer(nullptr);
}
}
@@ -372,7 +372,7 @@ Module *BugDriver::ExtractMappedBlocksFromModule(const
outs() << "*** Basic Block extraction failed!\n";
errs() << "Error creating temporary file: " << EC.message() << "\n";
EmitProgressBitcode(M, "basicblockextractfail", true);
- return 0;
+ return nullptr;
}
sys::RemoveFileOnSignal(Filename);
@@ -391,7 +391,7 @@ Module *BugDriver::ExtractMappedBlocksFromModule(const
errs() << "Error writing list of blocks to not extract\n";
EmitProgressBitcode(M, "basicblockextractfail", true);
BlocksToNotExtractFile.os().clear_error();
- return 0;
+ return nullptr;
}
BlocksToNotExtractFile.keep();
@@ -405,7 +405,7 @@ Module *BugDriver::ExtractMappedBlocksFromModule(const
sys::fs::remove(Filename.c_str());
- if (Ret == 0) {
+ if (!Ret) {
outs() << "*** Basic Block extraction failed, please report a bug!\n";
EmitProgressBitcode(M, "basicblockextractfail", true);
}
diff --git a/tools/bugpoint/FindBugs.cpp b/tools/bugpoint/FindBugs.cpp
index e2941f6f43..a0c859b7f3 100644
--- a/tools/bugpoint/FindBugs.cpp
+++ b/tools/bugpoint/FindBugs.cpp
@@ -45,7 +45,7 @@ bool BugDriver::runManyPasses(const std::vector<std::string> &AllPasses,
return false;
}
- srand(time(NULL));
+ srand(time(nullptr));
unsigned num = 1;
while(1) {
diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp
index fecae60c41..f5936ac88e 100644
--- a/tools/bugpoint/Miscompilation.cpp
+++ b/tools/bugpoint/Miscompilation.cpp
@@ -235,7 +235,7 @@ static Module *TestMergedProgram(const BugDriver &BD, Module *M1, Module *M2,
if (!Error.empty()) {
// Delete the linked module
delete M1;
- return NULL;
+ return nullptr;
}
return M1;
}
@@ -592,7 +592,7 @@ static bool ExtractBlocks(BugDriver &BD,
MiscompiledFunctions,
VMap);
Module *Extracted = BD.ExtractMappedBlocksFromModule(Blocks, ToExtract);
- if (Extracted == 0) {
+ if (!Extracted) {
// Weird, extraction should have worked.
errs() << "Nondeterministic problem extracting blocks??\n";
delete ProgClone;
@@ -845,7 +845,7 @@ static void CleanupAndPrepareModules(BugDriver &BD, Module *&Test,
Safe->getOrInsertFunction("getPointerToNamedFunction",
Type::getInt8PtrTy(Safe->getContext()),
Type::getInt8PtrTy(Safe->getContext()),
- (Type *)0);
+ (Type *)nullptr);
// Use the function we just added to get addresses of functions we need.
for (Module::iterator F = Safe->begin(), E = Safe->end(); F != E; ++F) {
diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp
index eaea9d9ed5..b2722e6d0e 100644
--- a/tools/bugpoint/OptimizerDriver.cpp
+++ b/tools/bugpoint/OptimizerDriver.cpp
@@ -196,7 +196,7 @@ bool BugDriver::runPasses(Module *Program,
Args.push_back(InputFilename.c_str());
for (unsigned i = 0; i < NumExtraArgs; ++i)
Args.push_back(*ExtraArgs);
- Args.push_back(0);
+ Args.push_back(nullptr);
DEBUG(errs() << "\nAbout to run:\t";
for (unsigned i = 0, e = Args.size()-1; i != e; ++i)
@@ -212,12 +212,12 @@ bool BugDriver::runPasses(Module *Program,
// Redirect stdout and stderr to nowhere if SilencePasses is given
StringRef Nowhere;
- const StringRef *Redirects[3] = {0, &Nowhere, &Nowhere};
+ const StringRef *Redirects[3] = {nullptr, &Nowhere, &Nowhere};
std::string ErrMsg;
- int result = sys::ExecuteAndWait(Prog, Args.data(), 0,
- (SilencePasses ? Redirects : 0), Timeout,
- MemoryLimit, &ErrMsg);
+ int result = sys::ExecuteAndWait(Prog, Args.data(), nullptr,
+ (SilencePasses ? Redirects : nullptr),
+ Timeout, MemoryLimit, &ErrMsg);
// If we are supposed to delete the bitcode file or if the passes crashed,
// remove it now. This may fail if the file was never created, but that's ok.
@@ -264,11 +264,11 @@ Module *BugDriver::runPassesOn(Module *M,
EmitProgressBitcode(M, "pass-error", false);
exit(debugOptimizerCrash());
}
- return 0;
+ return nullptr;
}
Module *Ret = ParseInputFile(BitcodeResult, Context);
- if (Ret == 0) {
+ if (!Ret) {
errs() << getToolName() << ": Error reading bitcode file '"
<< BitcodeResult << "'!\n";
exit(1);
diff --git a/tools/bugpoint/ToolRunner.cpp b/tools/bugpoint/ToolRunner.cpp
index e1c995f519..c481b03e2b 100644
--- a/tools/bugpoint/ToolRunner.cpp
+++ b/tools/bugpoint/ToolRunner.cpp
@@ -62,7 +62,7 @@ static int RunProgramWithTimeout(StringRef ProgramPath,
StringRef StdErrFile,
unsigned NumSeconds = 0,
unsigned MemoryLimit = 0,
- std::string *ErrMsg = 0) {
+ std::string *ErrMsg = nullptr) {
const StringRef *Redirects[3] = { &StdInFile, &StdOutFile, &StdErrFile };
#if 0 // For debug purposes
@@ -74,7 +74,7 @@ static int RunProgramWithTimeout(StringRef ProgramPath,
}
#endif
- return sys::ExecuteAndWait(ProgramPath, Args, 0, Redirects,
+ return sys::ExecuteAndWait(ProgramPath, Args, nullptr, Redirects,
NumSeconds, MemoryLimit, ErrMsg);
}
@@ -103,7 +103,7 @@ static int RunProgramRemotelyWithTimeout(StringRef RemoteClientPath,
#endif
// Run the program remotely with the remote client
- int ReturnCode = sys::ExecuteAndWait(RemoteClientPath, Args, 0,
+ int ReturnCode = sys::ExecuteAndWait(RemoteClientPath, Args, nullptr,
Redirects, NumSeconds, MemoryLimit);
// Has the remote client fail?
@@ -219,7 +219,7 @@ int LLI::ExecuteProgram(const std::string &Bitcode,
// Add optional parameters to the running program from Argv
for (unsigned i=0, e = Args.size(); i != e; ++i)
LLIArgs.push_back(Args[i].c_str());
- LLIArgs.push_back(0);
+ LLIArgs.push_back(nullptr);
outs() << "<lli>"; outs().flush();
DEBUG(errs() << "\nAbout to run:\t";
@@ -277,7 +277,7 @@ AbstractInterpreter *AbstractInterpreter::createLLI(const char *Argv0,
}
Message = "Cannot find `lli' in executable directory!\n";
- return 0;
+ return nullptr;
}
//===---------------------------------------------------------------------===//
@@ -328,7 +328,7 @@ void CustomCompiler::compileProgram(const std::string &Bitcode,
for (std::size_t i = 0; i < CompilerArgs.size(); ++i)
ProgramArgs.push_back(CompilerArgs.at(i).c_str());
ProgramArgs.push_back(Bitcode.c_str());
- ProgramArgs.push_back(0);
+ ProgramArgs.push_back(nullptr);
// Add optional parameters to the running program from Argv
for (unsigned i = 0, e = CompilerArgs.size(); i != e; ++i)
@@ -385,7 +385,7 @@ int CustomExecutor::ExecuteProgram(const std::string &Bitcode,
for (std::size_t i = 0; i < ExecutorArgs.size(); ++i)
ProgramArgs.push_back(ExecutorArgs.at(i).c_str());
ProgramArgs.push_back(Bitcode.c_str());
- ProgramArgs.push_back(0);
+ ProgramArgs.push_back(nullptr);
// Add optional parameters to the running program from Argv
for (unsigned i = 0, e = Args.size(); i != e; ++i)
@@ -448,7 +448,7 @@ AbstractInterpreter *AbstractInterpreter::createCustomCompiler(
std::vector<std::string> Args;
lexCommand(Message, CompileCommandLine, CmdPath, Args);
if (CmdPath.empty())
- return 0;
+ return nullptr;
return new CustomCompiler(CmdPath, Args);
}
@@ -464,7 +464,7 @@ AbstractInterpreter *AbstractInterpreter::createCustomExecutor(
std::vector<std::string> Args;
lexCommand(Message, ExecCommandLine, CmdPath, Args);
if (CmdPath.empty())
- return 0;
+ return nullptr;
return new CustomExecutor(CmdPath, Args);
}
@@ -499,7 +499,7 @@ GCC::FileType LLC::OutputCode(const std::string &Bitcode,
if (UseIntegratedAssembler)
LLCArgs.push_back("-filetype=obj");
- LLCArgs.push_back (0);
+ LLCArgs.push_back (nullptr);
outs() << (UseIntegratedAssembler ? "<llc-ia>" : "<llc>");
outs().flush();
@@ -559,7 +559,7 @@ LLC *AbstractInterpreter::createLLC(const char *Argv0,
PrependMainExecutablePath("llc", Argv0, (void *)(intptr_t) & createLLC);
if (LLCPath.empty()) {
Message = "Cannot find `llc' in executable directory!\n";
- return 0;
+ return nullptr;
}
GCC *gcc = GCC::create(Message, GCCBinary, GCCArgs);
@@ -625,7 +625,7 @@ int JIT::ExecuteProgram(const std::string &Bitcode,
// Add optional parameters to the running program from Argv
for (unsigned i=0, e = Args.size(); i != e; ++i)
JITArgs.push_back(Args[i].c_str());
- JITArgs.push_back(0);
+ JITArgs.push_back(nullptr);
outs() << "<jit>"; outs().flush();
DEBUG(errs() << "\nAbout to run:\t";
@@ -651,7 +651,7 @@ AbstractInterpreter *AbstractInterpreter::createJIT(const char *Argv0,
}
Message = "Cannot find `lli' in executable directory!\n";
- return 0;
+ return nullptr;
}
//===---------------------------------------------------------------------===//
@@ -737,7 +737,7 @@ int GCC::ExecuteProgram(const std::string &ProgramFile,
#endif
if (TargetTriple.getArch() == Triple::sparc)
GCCArgs.push_back("-mcpu=v9");
- GCCArgs.push_back(0); // NULL terminator
+ GCCArgs.push_back(nullptr); // NULL terminator
outs() << "<gcc>"; outs().flush();
DEBUG(errs() << "\nAbout to run:\t";
@@ -786,7 +786,7 @@ int GCC::ExecuteProgram(const std::string &ProgramFile,
// Add optional parameters to the running program from Argv
for (unsigned i = 0, e = Args.size(); i != e; ++i)
ProgramArgs.push_back(Args[i].c_str());
- ProgramArgs.push_back(0); // NULL terminator
+ ProgramArgs.push_back(nullptr); // NULL terminator
// Now that we have a binary, run it!
outs() << "<program>"; outs().flush();
@@ -885,7 +885,7 @@ int GCC::MakeSharedObject(const std::string &InputFile, FileType fileType,
// command line, so this should be safe.
for (unsigned i = 0, e = ArgsForGCC.size(); i != e; ++i)
GCCArgs.push_back(ArgsForGCC[i].c_str());
- GCCArgs.push_back(0); // NULL terminator
+ GCCArgs.push_back(nullptr); // NULL terminator
@@ -910,7 +910,7 @@ GCC *GCC::create(std::string &Message,
std::string GCCPath = sys::FindProgramByName(GCCBinary);
if (GCCPath.empty()) {
Message = "Cannot find `"+ GCCBinary +"' in PATH!\n";
- return 0;
+ return nullptr;
}
std::string RemoteClientPath;
diff --git a/tools/bugpoint/bugpoint.cpp b/tools/bugpoint/bugpoint.cpp
index 5c03b41abb..c7dae0f45b 100644
--- a/tools/bugpoint/bugpoint.cpp
+++ b/tools/bugpoint/bugpoint.cpp
@@ -99,7 +99,7 @@ namespace {
class AddToDriver : public FunctionPassManager {
BugDriver &D;
public:
- AddToDriver(BugDriver &_D) : FunctionPassManager(0), D(_D) {}
+ AddToDriver(BugDriver &_D) : FunctionPassManager(nullptr), D(_D) {}
void add(Pass *P) override {
const void *ID = P->getPassID();