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

Unified Diff: lib/IRReader/IRReader.cpp

Issue 770853002: Fix error reporting in the PNaCl bitcode reader. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Fix nits. Created 6 years 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
Index: lib/IRReader/IRReader.cpp
diff --git a/lib/IRReader/IRReader.cpp b/lib/IRReader/IRReader.cpp
index d55e1cea656401f2e5fe8e780d66355c089d4eaa..a76d371914e65cbcbd9c1787977640b409510139 100644
--- a/lib/IRReader/IRReader.cpp
+++ b/lib/IRReader/IRReader.cpp
@@ -108,13 +108,13 @@ Module *llvm::NaClParseIR(MemoryBuffer *Buffer,
if ((Format == PNaClFormat) &&
isNaClBitcode((const unsigned char *)Buffer->getBufferStart(),
(const unsigned char *)Buffer->getBufferEnd())) {
- std::string ErrMsg;
- Module *M = NaClParseBitcodeFile(Buffer, Context, &ErrMsg);
- if (M == 0)
+ ErrorOr<Module *> MOrErr =
jvoung (off chromium) 2014/12/01 23:23:50 "ModuleOrError" to be consistent with ParseIR() ?
JF 2014/12/02 00:49:04 Upstream uses MOrErr, so I'd keep that.
Karl 2014/12/03 18:32:10 Since our local version uses ModuleOrError, will m
+ NaClParseBitcodeFile(Buffer, Context, /*VerboseErrors=*/false);
jvoung (off chromium) 2014/12/01 23:23:50 how do you decide between setting VerboseErrors to
Karl 2014/12/03 18:32:10 Good point. Adding as argument so that calling too
+ if (std::error_code EC = MOrErr.getError())
Err = SMDiagnostic(Buffer->getBufferIdentifier(), SourceMgr::DK_Error,
- ErrMsg);
+ EC.message());
// ParseBitcodeFile does not take ownership of the Buffer.
- return M;
+ return MOrErr.get();
} else if (Format == LLVMFormat) {
if (isBitcode((const unsigned char *)Buffer->getBufferStart(),
(const unsigned char *)Buffer->getBufferEnd())) {

Powered by Google App Engine
This is Rietveld 408576698