Generalize errStr() function so that it can handle any type of errors.

llvm-svn: 191069
This commit is contained in:
Rui Ueyama 2013-09-20 03:18:58 +00:00
parent 406e65c8d1
commit 391ffdf70e
1 changed files with 3 additions and 3 deletions

View File

@ -227,9 +227,9 @@ public:
/// \brief create an error string for printing purposes
virtual std::string errStr(llvm::error_code errc) {
if (errc == llvm::errc::no_such_file_or_directory)
return (Twine("Cannot open ") + _path).str();
llvm_unreachable("not handling errors");
std::string msg = errc.message();
Twine twine = Twine("Cannot open ") + _path + ": " + msg;
return twine.str();
}
/// \brief Create a lld::File node from the FileNode