Improve error message.

Previously the parser always printed out an error message followed
by "Invalid file type" even if the file type is correct.

llvm-svn: 210093
This commit is contained in:
Rui Ueyama 2014-06-03 08:40:49 +00:00
parent 9213a6bfa4
commit eafa806b72
1 changed files with 3 additions and 3 deletions

View File

@ -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";