[lld] r196185 - [PECOFF] Print reason if file parsing failed.
Rui Ueyama
ruiu at google.com
Mon Dec 2 16:57:19 PST 2013
Author: ruiu
Date: Mon Dec 2 18:57:19 2013
New Revision: 196185
URL: http://llvm.org/viewvc/llvm-project?rev=196185&view=rev
Log:
[PECOFF] Print reason if file parsing failed.
Modified:
lld/trunk/lib/Driver/WinLinkInputGraph.cpp
lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
Modified: lld/trunk/lib/Driver/WinLinkInputGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkInputGraph.cpp?rev=196185&r1=196184&r2=196185&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkInputGraph.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkInputGraph.cpp Mon Dec 2 18:57:19 2013
@@ -15,11 +15,15 @@ namespace lld {
error_code PECOFFFileNode::parse(const LinkingContext &ctx,
raw_ostream &diagnostics) {
ErrorOr<StringRef> filePath = getPath(ctx);
- if (!filePath)
+ if (!filePath) {
+ diagnostics << "File not found: " << _path << "\n";
return error_code(filePath);
+ }
- if (error_code ec = getBuffer(*filePath))
+ if (error_code ec = getBuffer(*filePath)) {
+ diagnostics << "Cannot open file: " << *filePath << "\n";
return ec;
+ }
if (ctx.logInputFiles())
diagnostics << *filePath << "\n";
Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp?rev=196185&r1=196184&r2=196185&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp Mon Dec 2 18:57:19 2013
@@ -854,7 +854,8 @@ error_code ReaderCOFF::handleDirectiveSe
// Print error message if error.
if (parseFailed) {
- llvm::errs() << "Failed to parse '" << directives << "'\n";
+ llvm::errs() << "Failed to parse '" << directives << "'\n"
+ << "Reason: " << errorMessage;
return make_error_code(llvm::object::object_error::invalid_file_type);
}
if (!errorMessage.empty()) {
More information about the llvm-commits
mailing list