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

Unified Diff: src/PNaClTranslator.cpp

Issue 870653002: Subzero: Initial implementation of multithreaded translation. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: clang-format Created 5 years, 11 months 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
« src/IceUtils.h ('K') | « src/PNaClTranslator.h ('k') | src/llvm2ice.cpp » ('j') | 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 dfe93ff99957601bf4c5c5366dd14e335ba79d92..9f4fba7495c26997fdc3064fa510a6dcb683a114 100644
--- a/src/PNaClTranslator.cpp
+++ b/src/PNaClTranslator.cpp
@@ -32,8 +32,6 @@
#include "IceOperand.h"
#include "PNaClTranslator.h"
-#include <memory>
-
namespace {
using namespace llvm;
@@ -159,7 +157,7 @@ public:
typedef std::vector<Ice::FunctionDeclaration *> FunctionDeclarationListType;
TopLevelParser(Ice::Translator &Translator, NaClBitcodeHeader &Header,
- NaClBitstreamCursor &Cursor, bool &ErrorStatus)
+ NaClBitstreamCursor &Cursor, std::error_code &ErrorStatus)
: NaClBitcodeParser(Cursor), Translator(Translator), Header(Header),
ErrorStatus(ErrorStatus), NumErrors(0), NumFunctionIds(0),
NumFunctionBlocks(0), BlockParser(nullptr) {}
@@ -362,7 +360,7 @@ private:
// The bitcode header.
NaClBitcodeHeader &Header;
// The exit status that should be set to true if an error occurs.
- bool &ErrorStatus;
+ std::error_code &ErrorStatus;
Karl 2015/01/26 22:53:47 As per our earlier discussion, This should be flex
Jim Stichnoth 2015/01/27 00:56:18 See the new ErrorCode class, which prefers the fir
// The number of errors reported.
unsigned NumErrors;
// The types associated with each type ID.
@@ -425,7 +423,7 @@ private:
};
bool TopLevelParser::Error(const std::string &Message) {
- ErrorStatus = true;
+ ErrorStatus.assign(1, std::generic_category());
++NumErrors;
Ice::GlobalContext *Context = Translator.getContext();
Ice::OstreamLocker L(Context);
@@ -2812,7 +2810,6 @@ private:
void ExitBlock() override {
InstallGlobalNamesAndGlobalVarInitializers();
- getTranslator().emitConstants();
}
void ProcessRecord() override;
@@ -2945,7 +2942,7 @@ void PNaClTranslator::translate(const std::string &IRFilename) {
MemoryBuffer::getFileOrSTDIN(IRFilename);
if (std::error_code EC = ErrOrFile.getError()) {
errs() << "Error reading '" << IRFilename << "': " << EC.message() << "\n";
- ErrorStatus = true;
+ ErrorStatus.assign(1, std::generic_category());
return;
}
@@ -2958,7 +2955,7 @@ void PNaClTranslator::translateBuffer(const std::string &IRFilename,
if (MemBuf->getBufferSize() % 4 != 0) {
errs() << IRFilename
<< ": Bitcode stream should be a multiple of 4 bytes in length.\n";
- ErrorStatus = true;
+ ErrorStatus.assign(1, std::generic_category());
return;
}
@@ -2969,7 +2966,7 @@ void PNaClTranslator::translateBuffer(const std::string &IRFilename,
NaClBitcodeHeader Header;
if (Header.Read(BufPtr, EndBufPtr) || !Header.IsSupported()) {
errs() << "Invalid PNaCl bitcode header.\n";
- ErrorStatus = true;
+ ErrorStatus.assign(1, std::generic_category());
return;
}
@@ -2981,7 +2978,7 @@ void PNaClTranslator::translateBuffer(const std::string &IRFilename,
int TopLevelBlocks = 0;
while (!InputStream.AtEndOfStream()) {
if (Parser.Parse()) {
- ErrorStatus = true;
+ ErrorStatus.assign(1, std::generic_category());
return;
}
++TopLevelBlocks;
@@ -2991,7 +2988,7 @@ void PNaClTranslator::translateBuffer(const std::string &IRFilename,
errs() << IRFilename
<< ": Contains more than one module. Found: " << TopLevelBlocks
<< "\n";
- ErrorStatus = true;
+ ErrorStatus.assign(1, std::generic_category());
}
}
« src/IceUtils.h ('K') | « src/PNaClTranslator.h ('k') | src/llvm2ice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698