[lld] r210093 - Improve error message.
Rui Ueyama
ruiu at google.com
Tue Jun 3 01:40:49 PDT 2014
Author: ruiu
Date: Tue Jun 3 03:40:49 2014
New Revision: 210093
URL: http://llvm.org/viewvc/llvm-project?rev=210093&view=rev
Log:
Improve error message.
Previously the parser always printed out an error message followed
by "Invalid file type" even if the file type is correct.
Modified:
lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp?rev=210093&r1=210092&r2=210093&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp Tue Jun 3 03:40:49 2014
@@ -1079,9 +1079,9 @@ private:
stream.flush();
// Print error message if error.
if (parseFailed) {
- llvm::errs() << "Failed to parse '" << directives << "'\n"
- << "Reason: " << errorMessage;
- return make_error_code(llvm::object::object_error::invalid_file_type);
+ auto msg = Twine("Failed to parse '") + directives + "'\n"
+ + "Reason: " + errorMessage;
+ return make_dynamic_error_code(msg);
}
if (!errorMessage.empty()) {
llvm::errs() << "lld warning: " << errorMessage << "\n";
More information about the llvm-commits
mailing list