Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: src/PNaClTranslator.cpp

Issue 752603003: Merge remote-tracking branch 'origin/merge_35' (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceTranslator.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/PNaClTranslator.cpp
diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp
index 042b7fe723dac940836273f2f9da7e288db680cb..9c1b65fd6d0b71d9a3c07c4a07ddff423a571761 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 @@ bool TopLevelParser::ParseBlock(unsigned BlockID) {
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";
« no previous file with comments | « src/IceTranslator.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698