Handle "file not found" error in the superclass's errStr().

If a subclass does not override the member function, the superclass's method
takes care of string conversion of "file not found" error. This is a reasonable
default behavior. Subclasses are still able to override to customize error
messages.

llvm-svn: 191058
This commit is contained in:
Rui Ueyama 2013-09-20 00:32:40 +00:00
parent f7ec86a55b
commit 388fbd8f31
1 changed files with 3 additions and 1 deletions

View File

@ -226,7 +226,9 @@ public:
}
/// \brief create an error string for printing purposes
virtual std::string errStr(llvm::error_code) {
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");
}