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

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 typo. 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
« no previous file with comments | « tools/pnacl-benchmark/pnacl-benchmark.cpp ('k') | tools/pnacl-thaw/pnacl-thaw.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d7eaa8d9692634a2fb9676db7f9bc32a015d1c7c 100644
--- a/tools/pnacl-llc/pnacl-llc.cpp
+++ b/tools/pnacl-llc/pnacl-llc.cpp
@@ -323,12 +323,15 @@ static Module* getModule(StringRef ProgramName, LLVMContext &Context,
StreamingMemoryObject *StreamingObject) {
Module *M = nullptr;
SMDiagnostic Err;
+ std::string VerboseBuffer;
+ raw_string_ostream VerboseStrm(VerboseBuffer);
if (LazyBitcode) {
std::string StrError;
if (InputFileFormat == PNaClFormat) {
M = getNaClStreamedBitcodeModule(
InputFilename,
- new ThreadedStreamingCache(StreamingObject), Context, &StrError);
+ new ThreadedStreamingCache(StreamingObject), Context, &VerboseStrm,
+ &StrError);
} else if (InputFileFormat == LLVMFormat) {
M = getStreamedBitcodeModule(
InputFilename,
@@ -344,15 +347,17 @@ 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);
+ M = NaClParseIRFile(InputFilename, InputFileFormat, Err, &VerboseStrm,
+ Context);
#endif
}
if (!M) {
#if defined(__native_client__)
- report_fatal_error(Err.getMessage());
+ report_fatal_error(VerboseStrm.str() + Err.getMessage());
#else
// Err.print is prettier, so use it for the non-sandboxed translator.
Err.print(ProgramName.data(), errs());
+ errs() << VerboseStrm.str();
return nullptr;
#endif
}
« no previous file with comments | « tools/pnacl-benchmark/pnacl-benchmark.cpp ('k') | tools/pnacl-thaw/pnacl-thaw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698