diff options
Diffstat (limited to 'contrib/llvm/tools/bugpoint/BugDriver.cpp')
-rw-r--r-- | contrib/llvm/tools/bugpoint/BugDriver.cpp | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/contrib/llvm/tools/bugpoint/BugDriver.cpp b/contrib/llvm/tools/bugpoint/BugDriver.cpp index cecccbe0f0ef..b8be17e44dd2 100644 --- a/contrib/llvm/tools/bugpoint/BugDriver.cpp +++ b/contrib/llvm/tools/bugpoint/BugDriver.cpp @@ -82,14 +82,10 @@ BugDriver::~BugDriver() { delete gcc; } - -/// ParseInputFile - Given a bitcode or assembly input filename, parse and -/// return it, or return null if not possible. -/// -Module *llvm::ParseInputFile(const std::string &Filename, - LLVMContext& Ctxt) { +std::unique_ptr<Module> llvm::parseInputFile(StringRef Filename, + LLVMContext &Ctxt) { SMDiagnostic Err; - Module *Result = ParseIRFile(Filename, Err, Ctxt); + std::unique_ptr<Module> Result = parseIRFile(Filename, Err, Ctxt); if (!Result) Err.print("bugpoint", errs()); @@ -120,23 +116,18 @@ bool BugDriver::addSources(const std::vector<std::string> &Filenames) { assert(!Filenames.empty() && "Must specify at least on input filename!"); // Load the first input file. - Program = ParseInputFile(Filenames[0], Context); + Program = parseInputFile(Filenames[0], Context).release(); 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)); + std::unique_ptr<Module> M = parseInputFile(Filenames[i], Context); if (!M.get()) return true; outs() << "Linking in input file: '" << Filenames[i] << "'\n"; - std::string ErrorMessage; - if (Linker::LinkModules(Program, M.get(), Linker::DestroySource, - &ErrorMessage)) { - errs() << ToolName << ": error linking in '" << Filenames[i] << "': " - << ErrorMessage << '\n'; + if (Linker::LinkModules(Program, M.get())) return true; - } } outs() << "*** All input ok\n"; |