Commit 79f2a03b by JF Bastien

Merge remote-tracking branch 'origin/merge_35'

parent d2cb4361
...@@ -103,7 +103,7 @@ void Translator::emitConstants() { ...@@ -103,7 +103,7 @@ void Translator::emitConstants() {
void Translator::lowerGlobals( void Translator::lowerGlobals(
const VariableDeclarationListType &VariableDeclarations) { const VariableDeclarationListType &VariableDeclarations) {
llvm::OwningPtr<TargetGlobalInitLowering> GlobalLowering( std::unique_ptr<TargetGlobalInitLowering> GlobalLowering(
TargetGlobalInitLowering::createLowering(Ctx->getTargetArch(), Ctx)); TargetGlobalInitLowering::createLowering(Ctx->getTargetArch(), Ctx));
bool DisableTranslation = Ctx->getFlags().DisableTranslation; bool DisableTranslation = Ctx->getFlags().DisableTranslation;
const bool DumpGlobalVariables = const bool DumpGlobalVariables =
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "llvm/ADT/SmallString.h"
#include "llvm/Analysis/NaCl/PNaClABIProps.h" #include "llvm/Analysis/NaCl/PNaClABIProps.h"
#include "llvm/Bitcode/NaCl/NaClBitcodeDecoders.h" #include "llvm/Bitcode/NaCl/NaClBitcodeDecoders.h"
#include "llvm/Bitcode/NaCl/NaClBitcodeHeader.h" #include "llvm/Bitcode/NaCl/NaClBitcodeHeader.h"
...@@ -35,6 +36,8 @@ ...@@ -35,6 +36,8 @@
#include "IceTypeConverter.h" #include "IceTypeConverter.h"
#include "PNaClTranslator.h" #include "PNaClTranslator.h"
#include <memory>
namespace { namespace {
using namespace llvm; using namespace llvm;
...@@ -2827,14 +2830,15 @@ bool TopLevelParser::ParseBlock(unsigned BlockID) { ...@@ -2827,14 +2830,15 @@ bool TopLevelParser::ParseBlock(unsigned BlockID) {
namespace Ice { namespace Ice {
void PNaClTranslator::translate(const std::string &IRFilename) { void PNaClTranslator::translate(const std::string &IRFilename) {
OwningPtr<MemoryBuffer> MemBuf; ErrorOr<std::unique_ptr<MemoryBuffer>> ErrOrFile =
if (error_code ec = MemoryBuffer::getFileOrSTDIN(IRFilename);
MemoryBuffer::getFileOrSTDIN(IRFilename.c_str(), MemBuf)) { if (std::error_code EC = ErrOrFile.getError()) {
errs() << "Error reading '" << IRFilename << "': " << ec.message() << "\n"; errs() << "Error reading '" << IRFilename << "': " << EC.message() << "\n";
ErrorStatus = true; ErrorStatus = true;
return; return;
} }
std::unique_ptr<MemoryBuffer> MemBuf(ErrOrFile.get().release());
if (MemBuf->getBufferSize() % 4 != 0) { if (MemBuf->getBufferSize() % 4 != 0) {
errs() << IRFilename errs() << IRFilename
<< ": Bitcode stream should be a multiple of 4 bytes in length.\n"; << ": Bitcode stream should be a multiple of 4 bytes in length.\n";
......
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