summaryrefslogtreecommitdiff
path: root/llvm/tools/bugpoint
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2020-07-26 19:36:28 +0000
committerDimitry Andric <dim@FreeBSD.org>2020-07-26 19:36:28 +0000
commitcfca06d7963fa0909f90483b42a6d7d194d01e08 (patch)
tree209fb2a2d68f8f277793fc8df46c753d31bc853b /llvm/tools/bugpoint
parent706b4fc47bbc608932d3b491ae19a3b9cde9497b (diff)
Notes
Diffstat (limited to 'llvm/tools/bugpoint')
-rw-r--r--llvm/tools/bugpoint/CrashDebugger.cpp13
-rw-r--r--llvm/tools/bugpoint/ExecutionDriver.cpp4
-rw-r--r--llvm/tools/bugpoint/Miscompilation.cpp30
-rw-r--r--llvm/tools/bugpoint/OptimizerDriver.cpp2
-rw-r--r--llvm/tools/bugpoint/ToolRunner.cpp4
-rw-r--r--llvm/tools/bugpoint/ToolRunner.h2
-rw-r--r--llvm/tools/bugpoint/bugpoint.cpp4
7 files changed, 35 insertions, 24 deletions
diff --git a/llvm/tools/bugpoint/CrashDebugger.cpp b/llvm/tools/bugpoint/CrashDebugger.cpp
index aa88a06a6df0..1a39ff654f05 100644
--- a/llvm/tools/bugpoint/CrashDebugger.cpp
+++ b/llvm/tools/bugpoint/CrashDebugger.cpp
@@ -499,7 +499,8 @@ bool ReduceCrashingBlocks::TestBlocks(std::vector<const BasicBlock *> &BBs) {
std::vector<std::pair<std::string, std::string>> BlockInfo;
for (BasicBlock *BB : Blocks)
- BlockInfo.emplace_back(BB->getParent()->getName(), BB->getName());
+ BlockInfo.emplace_back(std::string(BB->getParent()->getName()),
+ std::string(BB->getName()));
SmallVector<BasicBlock *, 16> ToProcess;
for (auto &F : *M) {
@@ -606,7 +607,8 @@ bool ReduceCrashingConditionals::TestBlocks(
std::vector<std::pair<std::string, std::string>> BlockInfo;
for (const BasicBlock *BB : Blocks)
- BlockInfo.emplace_back(BB->getParent()->getName(), BB->getName());
+ BlockInfo.emplace_back(std::string(BB->getParent()->getName()),
+ std::string(BB->getName()));
SmallVector<BasicBlock *, 16> ToProcess;
for (auto &F : *M) {
@@ -696,7 +698,8 @@ bool ReduceSimplifyCFG::TestBlocks(std::vector<const BasicBlock *> &BBs) {
std::vector<std::pair<std::string, std::string>> BlockInfo;
for (const BasicBlock *BB : Blocks)
- BlockInfo.emplace_back(BB->getParent()->getName(), BB->getName());
+ BlockInfo.emplace_back(std::string(BB->getParent()->getName()),
+ std::string(BB->getName()));
// Loop over and delete any hack up any blocks that are not listed...
for (auto &F : *M)
@@ -861,7 +864,7 @@ bool ReduceCrashingMetadata::TestInsts(std::vector<Instruction *> &Insts) {
// selected in Instructions.
for (Function &F : *M)
for (Instruction &Inst : instructions(F)) {
- if (Instructions.find(&Inst) == Instructions.end()) {
+ if (!Instructions.count(&Inst)) {
Inst.dropUnknownNonDebugMetadata();
Inst.setDebugLoc({});
}
@@ -1216,7 +1219,7 @@ static Error DebugACrash(BugDriver &BD, BugTester TestFn) {
// For each remaining function, try to reduce that function's attributes.
std::vector<std::string> FunctionNames;
for (Function &F : BD.getProgram())
- FunctionNames.push_back(F.getName());
+ FunctionNames.push_back(std::string(F.getName()));
if (!FunctionNames.empty() && !BugpointIsInterrupted) {
outs() << "\n*** Attempting to reduce the number of function attributes"
diff --git a/llvm/tools/bugpoint/ExecutionDriver.cpp b/llvm/tools/bugpoint/ExecutionDriver.cpp
index 40f198b88d1a..4c83a9598976 100644
--- a/llvm/tools/bugpoint/ExecutionDriver.cpp
+++ b/llvm/tools/bugpoint/ExecutionDriver.cpp
@@ -311,7 +311,7 @@ Expected<std::string> BugDriver::executeProgram(const Module &Program,
<< "!\n";
exit(1);
}
- BitcodeFile = UniqueFilename.str();
+ BitcodeFile = std::string(UniqueFilename.str());
if (writeProgramToFile(BitcodeFile, UniqueFD, Program)) {
errs() << ToolName << ": Error emitting bitcode to file '" << BitcodeFile
@@ -336,7 +336,7 @@ Expected<std::string> BugDriver::executeProgram(const Module &Program,
<< "\n";
exit(1);
}
- OutputFile = UniqueFile.str();
+ OutputFile = std::string(UniqueFile.str());
// Figure out which shared objects to run, if any.
std::vector<std::string> SharedObjs(AdditionalSOs);
diff --git a/llvm/tools/bugpoint/Miscompilation.cpp b/llvm/tools/bugpoint/Miscompilation.cpp
index 1621a51c91d6..e69fe9ff6c15 100644
--- a/llvm/tools/bugpoint/Miscompilation.cpp
+++ b/llvm/tools/bugpoint/Miscompilation.cpp
@@ -389,7 +389,8 @@ ExtractLoops(BugDriver &BD,
std::vector<std::pair<std::string, FunctionType *>> MisCompFunctions;
for (Function *F : MiscompiledFunctions) {
- MisCompFunctions.emplace_back(F->getName(), F->getFunctionType());
+ MisCompFunctions.emplace_back(std::string(F->getName()),
+ F->getFunctionType());
}
if (Linker::linkModules(*ToNotOptimize,
@@ -415,7 +416,8 @@ ExtractLoops(BugDriver &BD,
E = ToOptimizeLoopExtracted->end();
I != E; ++I)
if (!I->isDeclaration())
- MisCompFunctions.emplace_back(I->getName(), I->getFunctionType());
+ MisCompFunctions.emplace_back(std::string(I->getName()),
+ I->getFunctionType());
// Okay, great! Now we know that we extracted a loop and that loop
// extraction both didn't break the program, and didn't mask the problem.
@@ -586,7 +588,8 @@ ExtractBlocks(BugDriver &BD,
for (Module::iterator I = Extracted->begin(), E = Extracted->end(); I != E;
++I)
if (!I->isDeclaration())
- MisCompFunctions.emplace_back(I->getName(), I->getFunctionType());
+ MisCompFunctions.emplace_back(std::string(I->getName()),
+ I->getFunctionType());
if (Linker::linkModules(*ProgClone, std::move(Extracted)))
exit(1);
@@ -953,7 +956,8 @@ static Expected<bool> TestCodeGenerator(BugDriver &BD,
<< "Error making unique filename: " << EC.message() << "\n";
exit(1);
}
- if (BD.writeProgramToFile(TestModuleBC.str(), TestModuleFD, *Test)) {
+ if (BD.writeProgramToFile(std::string(TestModuleBC.str()), TestModuleFD,
+ *Test)) {
errs() << "Error writing bitcode to `" << TestModuleBC.str()
<< "'\nExiting.";
exit(1);
@@ -972,7 +976,8 @@ static Expected<bool> TestCodeGenerator(BugDriver &BD,
exit(1);
}
- if (BD.writeProgramToFile(SafeModuleBC.str(), SafeModuleFD, *Safe)) {
+ if (BD.writeProgramToFile(std::string(SafeModuleBC.str()), SafeModuleFD,
+ *Safe)) {
errs() << "Error writing bitcode to `" << SafeModuleBC << "'\nExiting.";
exit(1);
}
@@ -980,7 +985,7 @@ static Expected<bool> TestCodeGenerator(BugDriver &BD,
FileRemover SafeModuleBCRemover(SafeModuleBC.str(), !SaveTemps);
Expected<std::string> SharedObject =
- BD.compileSharedObject(SafeModuleBC.str());
+ BD.compileSharedObject(std::string(SafeModuleBC.str()));
if (Error E = SharedObject.takeError())
return std::move(E);
@@ -988,8 +993,8 @@ static Expected<bool> TestCodeGenerator(BugDriver &BD,
// Run the code generator on the `Test' code, loading the shared library.
// The function returns whether or not the new output differs from reference.
- Expected<bool> Result =
- BD.diffProgram(BD.getProgram(), TestModuleBC.str(), *SharedObject, false);
+ Expected<bool> Result = BD.diffProgram(
+ BD.getProgram(), std::string(TestModuleBC.str()), *SharedObject, false);
if (Error E = Result.takeError())
return std::move(E);
@@ -1046,7 +1051,8 @@ Error BugDriver::debugCodeGenerator() {
exit(1);
}
- if (writeProgramToFile(TestModuleBC.str(), TestModuleFD, *ToCodeGen)) {
+ if (writeProgramToFile(std::string(TestModuleBC.str()), TestModuleFD,
+ *ToCodeGen)) {
errs() << "Error writing bitcode to `" << TestModuleBC << "'\nExiting.";
exit(1);
}
@@ -1062,11 +1068,13 @@ Error BugDriver::debugCodeGenerator() {
exit(1);
}
- if (writeProgramToFile(SafeModuleBC.str(), SafeModuleFD, *ToNotCodeGen)) {
+ if (writeProgramToFile(std::string(SafeModuleBC.str()), SafeModuleFD,
+ *ToNotCodeGen)) {
errs() << "Error writing bitcode to `" << SafeModuleBC << "'\nExiting.";
exit(1);
}
- Expected<std::string> SharedObject = compileSharedObject(SafeModuleBC.str());
+ Expected<std::string> SharedObject =
+ compileSharedObject(std::string(SafeModuleBC.str()));
if (Error E = SharedObject.takeError())
return E;
diff --git a/llvm/tools/bugpoint/OptimizerDriver.cpp b/llvm/tools/bugpoint/OptimizerDriver.cpp
index 64af81fcc8a1..25a970bd6878 100644
--- a/llvm/tools/bugpoint/OptimizerDriver.cpp
+++ b/llvm/tools/bugpoint/OptimizerDriver.cpp
@@ -141,7 +141,7 @@ bool BugDriver::runPasses(Module &Program,
<< ": Error making unique filename: " << EC.message() << "\n";
return 1;
}
- OutputFilename = UniqueFilename.str();
+ OutputFilename = std::string(UniqueFilename.str());
// set up the input file name
Expected<sys::fs::TempFile> Temp =
diff --git a/llvm/tools/bugpoint/ToolRunner.cpp b/llvm/tools/bugpoint/ToolRunner.cpp
index 19b2ea2c0181..d880aca044d1 100644
--- a/llvm/tools/bugpoint/ToolRunner.cpp
+++ b/llvm/tools/bugpoint/ToolRunner.cpp
@@ -442,7 +442,7 @@ Expected<CC::FileType> LLC::OutputCode(const std::string &Bitcode,
errs() << "Error making unique filename: " << EC.message() << "\n";
exit(1);
}
- OutputAsmFile = UniqueFile.str();
+ OutputAsmFile = std::string(UniqueFile.str());
std::vector<StringRef> LLCArgs;
LLCArgs.push_back(LLCPath);
@@ -772,7 +772,7 @@ Error CC::MakeSharedObject(const std::string &InputFile, FileType fileType,
errs() << "Error making unique filename: " << EC.message() << "\n";
exit(1);
}
- OutputFile = UniqueFilename.str();
+ OutputFile = std::string(UniqueFilename.str());
std::vector<StringRef> CCArgs;
diff --git a/llvm/tools/bugpoint/ToolRunner.h b/llvm/tools/bugpoint/ToolRunner.h
index dde4ec539cfb..f6b5f26c7a66 100644
--- a/llvm/tools/bugpoint/ToolRunner.h
+++ b/llvm/tools/bugpoint/ToolRunner.h
@@ -40,7 +40,7 @@ class CC {
std::vector<std::string> ccArgs; // CC-specific arguments.
CC(StringRef ccPath, StringRef RemotePath,
const std::vector<std::string> *CCArgs)
- : CCPath(ccPath), RemoteClientPath(RemotePath) {
+ : CCPath(std::string(ccPath)), RemoteClientPath(std::string(RemotePath)) {
if (CCArgs)
ccArgs = *CCArgs;
}
diff --git a/llvm/tools/bugpoint/bugpoint.cpp b/llvm/tools/bugpoint/bugpoint.cpp
index d29a79ee3e13..937ec23231b0 100644
--- a/llvm/tools/bugpoint/bugpoint.cpp
+++ b/llvm/tools/bugpoint/bugpoint.cpp
@@ -110,7 +110,7 @@ public:
void add(Pass *P) override {
const void *ID = P->getPassID();
const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(ID);
- D.addPass(PI->getPassArgument());
+ D.addPass(std::string(PI->getPassArgument()));
}
};
}
@@ -221,7 +221,7 @@ int main(int argc, char **argv) {
AddOptimizationPasses(PM, 2, 2);
for (const PassInfo *PI : PassList)
- D.addPass(PI->getPassArgument());
+ D.addPass(std::string(PI->getPassArgument()));
// Bugpoint has the ability of generating a plethora of core files, so to
// avoid filling up the disk, we prevent it