//===- BugDriver.cpp - Top-Level BugPoint class implementation ------------===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// This class contains all of the shared state and information that is used by
//===----------------------------------------------------------------------===//
#include "BugDriver.h"
+#include "llvm/Linker.h"
#include "llvm/Module.h"
#include "llvm/Pass.h"
#include "llvm/Assembly/Parser.h"
#include "llvm/Bytecode/Reader.h"
-#include "llvm/Support/Linker.h"
#include "llvm/Support/ToolRunner.h"
-#include "Support/CommandLine.h"
-#include "Support/FileUtilities.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/FileUtilities.h"
+#include <iostream>
#include <memory>
+
using namespace llvm;
// Anonymous namespace to define command line options for debugging.
// otherwise the raw input run through an interpreter is used as the reference
// source.
//
- cl::opt<std::string>
+ cl::opt<std::string>
OutputFile("output", cl::desc("Specify a reference program output "
"(for miscompilation detection)"));
}
<< InputFilename << "'!\n";
}
} catch (const ParseException &E) {
- std::cerr << "bugpoint: " << E.getMessage() << "\n";
+ std::cerr << "bugpoint: " << E.getMessage() << '\n';
Result = 0;
}
return Result;
std::cout << "Linking in input file: '" << Filenames[i] << "'\n";
std::string ErrorMessage;
- if (LinkModules(Program, M.get(), &ErrorMessage)) {
+ if (Linker::LinkModules(Program, M.get(), &ErrorMessage)) {
std::cerr << ToolName << ": error linking in '" << Filenames[i] << "': "
- << ErrorMessage << "\n";
+ << ErrorMessage << '\n';
return true;
}
}
std::cout << "Running the code generator to test for a crash: ";
try {
compileProgram(Program);
- std::cout << "\n";
+ std::cout << '\n';
} catch (ToolExecutionError &TEE) {
std::cout << TEE.what();
return debugCodeGeneratorCrash();
//
bool CreatedOutput = false;
if (ReferenceOutputFile.empty()) {
- std::cout << "Generating reference output from raw program...";
+ std::cout << "Generating reference output from raw program: ";
try {
ReferenceOutputFile = executeProgramWithCBE("bugpoint.reference.out");
CreatedOutput = true;
- std::cout << "Reference output is: " << ReferenceOutputFile << "\n";
+ std::cout << "Reference output is: " << ReferenceOutputFile << '\n';
} catch (ToolExecutionError &TEE) {
std::cerr << TEE.what();
if (Interpreter != cbe) {
// Make sure the reference output file gets deleted on exit from this
// function, if appropriate.
- FileRemover RemoverInstance(ReferenceOutputFile, CreatedOutput);
+ sys::Path ROF(ReferenceOutputFile);
+ FileRemover RemoverInstance(ROF, CreatedOutput);
// Diff the output of the raw program against the reference output. If it
// matches, then we have a miscompilation bug.