Change the BugDriver to store the current module with std::unique_ptr.
While there, change a bunch of helper functions to take references to
avoid adding calls to get().
This should conclude the bugpoint yak shaving.
llvm-svn: 325177
diff --git a/llvm/tools/bugpoint/FindBugs.cpp b/llvm/tools/bugpoint/FindBugs.cpp
index 40502cb..a695e87 100644
--- a/llvm/tools/bugpoint/FindBugs.cpp
+++ b/llvm/tools/bugpoint/FindBugs.cpp
@@ -32,7 +32,7 @@
outs() << "\n";
if (ReferenceOutputFile.empty()) {
outs() << "Generating reference output from raw program: \n";
- if (Error E = createReferenceFile(Program))
+ if (Error E = createReferenceFile(*Program))
return E;
}
@@ -53,7 +53,7 @@
}
std::string Filename;
- if (runPasses(Program, PassesToRun, Filename, false)) {
+ if (runPasses(*Program, PassesToRun, Filename, false)) {
outs() << "\n";
outs() << "Optimizer passes caused failure!\n\n";
return debugOptimizerCrash();
@@ -65,7 +65,7 @@
// Step 3: Compile the optimized code.
//
outs() << "Running the code generator to test for a crash: ";
- if (Error E = compileProgram(Program)) {
+ if (Error E = compileProgram(*Program)) {
outs() << "\n*** compileProgram threw an exception: ";
outs() << toString(std::move(E));
return debugCodeGeneratorCrash();
@@ -77,7 +77,7 @@
// output (created above).
//
outs() << "*** Checking if passes caused miscompliation:\n";
- Expected<bool> Diff = diffProgram(Program, Filename, "", false);
+ Expected<bool> Diff = diffProgram(*Program, Filename, "", false);
if (Error E = Diff.takeError()) {
errs() << toString(std::move(E));
return debugCodeGeneratorCrash();