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

Unified Diff: tools/pnacl-llc/pnacl-llc.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/pnacl-llc/pnacl-llc.cpp
diff --git a/tools/pnacl-llc/pnacl-llc.cpp b/tools/pnacl-llc/pnacl-llc.cpp
index 5aefdf4e001f1716fb68a2658873b66152d31714..f958db42da3981efe643952f87e6c875174fd43e 100644
--- a/tools/pnacl-llc/pnacl-llc.cpp
+++ b/tools/pnacl-llc/pnacl-llc.cpp
@@ -90,6 +90,12 @@ InputFilename(cl::Positional, cl::desc("<input bitcode>"), cl::init("-"));
static cl::opt<std::string>
OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"));
+static cl::opt<bool>
+VerboseErrors(
+ "verbose-parse-errors",
+ cl::desc("Print out more descriptive PNaCl bitcode parse errors"),
+ cl::init(false));
+
// Using bitcode streaming allows compilation of one function at a time. This
// allows earlier functions to be compiled before later functions are read from
// the bitcode but of course means no whole-module optimizations. This means
@@ -326,9 +332,11 @@ static Module* getModule(StringRef ProgramName, LLVMContext &Context,
if (LazyBitcode) {
std::string StrError;
if (InputFileFormat == PNaClFormat) {
+ raw_ostream *Verbose = VerboseErrors ? &errs() : nullptr;
jvoung (off chromium) 2014/12/03 19:43:46 Now that this is a stream, __native_client__/pnacl
Karl 2014/12/03 20:53:44 Went ahead and added verbose errors if command lin
jvoung (off chromium) 2014/12/03 22:11:13 What I meant was why not pass in the VerboseStrm a
Karl 2014/12/03 22:28:51 Ok. I'll make it be always when in __native_client
M = getNaClStreamedBitcodeModule(
InputFilename,
- new ThreadedStreamingCache(StreamingObject), Context, &StrError);
+ new ThreadedStreamingCache(StreamingObject), Context, Verbose,
+ &StrError);
} else if (InputFileFormat == LLVMFormat) {
M = getStreamedBitcodeModule(
InputFilename,
@@ -344,7 +352,9 @@ static Module* getModule(StringRef ProgramName, LLVMContext &Context,
#else
// Parses binary bitcode as well as textual assembly
// (so pulls in more code into pnacl-llc).
- M = NaClParseIRFile(InputFilename, InputFileFormat, Err, Context);
+ raw_ostream *Verbose = VerboseErrors ? &errs() : nullptr;
+ M = NaClParseIRFile(InputFilename, InputFileFormat, Err, Verbose,
+ Context);
#endif
}
if (!M) {

Powered by Google App Engine
This is Rietveld 408576698