Commit 50de9b89 by Jan Voung

Changes to rebase Subzero to LLVM 223109 APIs.

parent 33a5f41d
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include "llvm/IR/LLVMContext.h" #include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IRReader/IRReader.h" #include "llvm/IRReader/IRReader.h"
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileSystem.h" #include "llvm/Support/FileSystem.h"
...@@ -331,13 +332,13 @@ int main(int argc, char **argv) { ...@@ -331,13 +332,13 @@ int main(int argc, char **argv) {
*Ls << "Error: writing binary ELF to stdout is unsupported\n"; *Ls << "Error: writing binary ELF to stdout is unsupported\n";
return GetReturnValue(Ice::EC_Args); return GetReturnValue(Ice::EC_Args);
} }
std::string ErrorInfo; std::error_code EC;
raw_fd_ostream *FdOs = raw_fd_ostream *FdOs =
new raw_fd_ostream(OutputFilename.c_str(), ErrorInfo, sys::fs::F_None); new raw_fd_ostream(OutputFilename, EC, sys::fs::F_None);
Os.reset(FdOs); Os.reset(FdOs);
if (!ErrorInfo.empty()) { if (EC) {
*Ls << "Failed to open output file: " << OutputFilename << ":\n" *Ls << "Failed to open output file: " << OutputFilename << ":\n"
<< ErrorInfo << "\n"; << EC.message() << "\n";
return GetReturnValue(Ice::EC_Args); return GetReturnValue(Ice::EC_Args);
} }
ELFStr.reset(new Ice::ELFStreamer(*FdOs)); ELFStr.reset(new Ice::ELFStreamer(*FdOs));
...@@ -374,16 +375,16 @@ int main(int argc, char **argv) { ...@@ -374,16 +375,16 @@ int main(int argc, char **argv) {
SMDiagnostic Err; SMDiagnostic Err;
Ice::TimerMarker T1(Ice::TimerStack::TT_parse, &Ctx); Ice::TimerMarker T1(Ice::TimerStack::TT_parse, &Ctx);
raw_ostream *Verbose = LLVMVerboseErrors ? &errs() : nullptr; raw_ostream *Verbose = LLVMVerboseErrors ? &errs() : nullptr;
Module *Mod = NaClParseIRFile(IRFilename, InputFileFormat, Err, Verbose, std::unique_ptr<Module> Mod =
NaClParseIRFile(IRFilename, InputFileFormat, Err, Verbose,
getGlobalContext()); getGlobalContext());
if (!Mod) { if (!Mod) {
Err.print(argv[0], errs()); Err.print(argv[0], errs());
return GetReturnValue(Ice::EC_Bitcode); return GetReturnValue(Ice::EC_Bitcode);
} }
std::unique_ptr<Ice::Converter> Converter( std::unique_ptr<Ice::Converter> Converter(
new Ice::Converter(Mod, &Ctx, Flags)); new Ice::Converter(Mod.get(), &Ctx, Flags));
Converter->convertToIce(); Converter->convertToIce();
Translator.reset(Converter.release()); Translator.reset(Converter.release());
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment