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

Unified Diff: lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp

Issue 180483005: Fix PNaCl-local files after merging LLVM 3.4 (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@hs-merge-before-fixes
Patch Set: Created 6 years, 10 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
« no previous file with comments | « lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h ('k') | lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp
diff --git a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp
index 7bfe378a6663260c13777cbc01443be54a80986a..05c75cd4fc2e76eeb3f0c58dd69cb691212bd56d 100644
--- a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp
+++ b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp
@@ -1490,24 +1490,34 @@ bool NaClBitcodeReader::isMaterializable(const GlobalValue *GV) const {
return false;
}
-bool NaClBitcodeReader::Materialize(GlobalValue *GV, std::string *ErrInfo) {
+error_code NaClBitcodeReader::Materialize(GlobalValue *GV) {
Function *F = dyn_cast<Function>(GV);
// If it's not a function or is already material, ignore the request.
- if (!F || !F->isMaterializable()) return false;
+ if (!F || !F->isMaterializable())
+ return error_code::success();
DenseMap<Function*, uint64_t>::iterator DFII = DeferredFunctionInfo.find(F);
assert(DFII != DeferredFunctionInfo.end() && "Deferred function not found!");
// If its position is recorded as 0, its body is somewhere in the stream
// but we haven't seen it yet.
- if (DFII->second == 0)
- if (LazyStreamer && FindFunctionInStream(F, DFII)) return true;
+ if (DFII->second == 0) {
+ if (FindFunctionInStream(F, DFII)) {
+ // Refactoring upstream in LLVM 3.4 means we can no longer
+ // return an error string here, so return a catch-all error
+ // code.
+ // TODO(mseaborn): Clean up the reader to return a more
+ // meaningful error_code here.
+ return make_error_code(errc::invalid_argument);
+ }
+ }
// Move the bit stream to the saved position of the deferred function body.
Stream.JumpToBit(DFII->second);
if (ParseFunctionBody(F)) {
- if (ErrInfo) *ErrInfo = ErrorString;
- return true;
+ // TODO(mseaborn): Clean up the reader to return a more meaningful
+ // error_code instead of a catch-all.
+ return make_error_code(errc::invalid_argument);
}
// Upgrade any old intrinsic calls in the function.
@@ -1522,7 +1532,7 @@ bool NaClBitcodeReader::Materialize(GlobalValue *GV, std::string *ErrInfo) {
}
}
- return false;
+ return error_code::success();
}
bool NaClBitcodeReader::isDematerializable(const GlobalValue *GV) const {
@@ -1545,16 +1555,18 @@ void NaClBitcodeReader::Dematerialize(GlobalValue *GV) {
}
-bool NaClBitcodeReader::MaterializeModule(Module *M, std::string *ErrInfo) {
+error_code NaClBitcodeReader::MaterializeModule(Module *M) {
assert(M == TheModule &&
"Can only Materialize the Module this NaClBitcodeReader is attached to.");
// Iterate over the module, deserializing any functions that are still on
// disk.
for (Module::iterator F = TheModule->begin(), E = TheModule->end();
- F != E; ++F)
- if (F->isMaterializable() &&
- Materialize(F, ErrInfo))
- return true;
+ F != E; ++F) {
+ if (F->isMaterializable()) {
+ if (error_code EC = Materialize(F))
+ return EC;
+ }
+ }
// At this point, if there are any function bodies, the current bit is
// pointing to the END_BLOCK record after them. Now make sure the rest
@@ -1581,7 +1593,7 @@ bool NaClBitcodeReader::MaterializeModule(Module *M, std::string *ErrInfo) {
}
std::vector<std::pair<Function*, Function*> >().swap(UpgradedIntrinsics);
- return false;
+ return error_code::success();
}
bool NaClBitcodeReader::InitStream() {
« no previous file with comments | « lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h ('k') | lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698