Index: src/PNaClTranslator.cpp |
diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp |
index 01ba264aed3f53cd3b6df77c6ca8386d24261934..b30328bdc065c56701f6bbf9ebc734ccbc3f8e90 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; |
@@ -162,7 +160,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) {} |
@@ -365,7 +363,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; |
// The number of errors reported. |
unsigned NumErrors; |
// The types associated with each type ID. |
@@ -428,7 +426,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); |
@@ -2822,7 +2820,6 @@ private: |
void ExitBlock() override { |
InstallGlobalNamesAndGlobalVarInitializers(); |
- getTranslator().emitConstants(); |
} |
void ProcessRecord() override; |
@@ -2955,7 +2952,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; |
} |
@@ -2968,7 +2965,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; |
} |
@@ -2979,7 +2976,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; |
} |
@@ -2991,7 +2988,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; |
@@ -3001,7 +2998,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()); |
} |
} |