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

Unified Diff: tools/llvm-dis/llvm-dis.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 issues and add test case. 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: tools/llvm-dis/llvm-dis.cpp
diff --git a/tools/llvm-dis/llvm-dis.cpp b/tools/llvm-dis/llvm-dis.cpp
index bdce91184a377f36175d2469ce0b2109b2d1be0d..0e9f19bf335420e5d4f54a7f8f6b900627515531 100644
--- a/tools/llvm-dis/llvm-dis.cpp
+++ b/tools/llvm-dis/llvm-dis.cpp
@@ -65,6 +65,12 @@ InputFileFormat(
clEnumValN(PNaClFormat, "pnacl", "PNaCl bitcode file"),
clEnumValEnd),
cl::init(LLVMFormat));
+
+static cl::opt<bool>
+VerboseErrors(
+ "verbose-parse-errors",
+ cl::desc("Print out more descriptive PNaCl bitcode parse errors"),
+ cl::init(false));
// @LOCALMOD-END
namespace {
@@ -160,10 +166,13 @@ int main(int argc, char **argv) {
M.reset(getStreamedBitcodeModule(
DisplayFilename, Buffer.release(), Context, &ErrorMessage));
break;
- case PNaClFormat:
+ case PNaClFormat: {
+ raw_ostream *Verbose = VerboseErrors ? &errs() : nullptr;
jvoung (off chromium) 2014/12/03 19:43:46 I guess I was okay with this unconditionally havin
Karl 2014/12/03 20:53:44 Since this is an LLVM tool, I guess we should be j
M.reset(getNaClStreamedBitcodeModule(
- DisplayFilename, Buffer.release(), Context, &ErrorMessage));
+ DisplayFilename, Buffer.release(), Context, Verbose,
+ &ErrorMessage));
break;
+ }
default:
ErrorMessage = "Don't understand specified bitcode format";
break;

Powered by Google App Engine
This is Rietveld 408576698