Merge remote-tracking branch 'origin/merge_35'
R=stichnot@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3930
Review URL: https://codereview.chromium.org/752603003
diff --git a/src/IceTranslator.cpp b/src/IceTranslator.cpp
index 954da47..2a50a41 100644
--- a/src/IceTranslator.cpp
+++ b/src/IceTranslator.cpp
@@ -103,7 +103,7 @@
void Translator::lowerGlobals(
const VariableDeclarationListType &VariableDeclarations) {
- llvm::OwningPtr<TargetGlobalInitLowering> GlobalLowering(
+ std::unique_ptr<TargetGlobalInitLowering> GlobalLowering(
TargetGlobalInitLowering::createLowering(Ctx->getTargetArch(), Ctx));
bool DisableTranslation = Ctx->getFlags().DisableTranslation;
const bool DumpGlobalVariables =
diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp
index 042b7fe..9c1b65fd 100644
--- a/src/PNaClTranslator.cpp
+++ b/src/PNaClTranslator.cpp
@@ -12,6 +12,7 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/ADT/SmallString.h"
#include "llvm/Analysis/NaCl/PNaClABIProps.h"
#include "llvm/Bitcode/NaCl/NaClBitcodeDecoders.h"
#include "llvm/Bitcode/NaCl/NaClBitcodeHeader.h"
@@ -35,6 +36,8 @@
#include "IceTypeConverter.h"
#include "PNaClTranslator.h"
+#include <memory>
+
namespace {
using namespace llvm;
@@ -2827,14 +2830,15 @@
namespace Ice {
void PNaClTranslator::translate(const std::string &IRFilename) {
- OwningPtr<MemoryBuffer> MemBuf;
- if (error_code ec =
- MemoryBuffer::getFileOrSTDIN(IRFilename.c_str(), MemBuf)) {
- errs() << "Error reading '" << IRFilename << "': " << ec.message() << "\n";
+ ErrorOr<std::unique_ptr<MemoryBuffer>> ErrOrFile =
+ MemoryBuffer::getFileOrSTDIN(IRFilename);
+ if (std::error_code EC = ErrOrFile.getError()) {
+ errs() << "Error reading '" << IRFilename << "': " << EC.message() << "\n";
ErrorStatus = true;
return;
}
+ std::unique_ptr<MemoryBuffer> MemBuf(ErrOrFile.get().release());
if (MemBuf->getBufferSize() % 4 != 0) {
errs() << IRFilename
<< ": Bitcode stream should be a multiple of 4 bytes in length.\n";