Remove windows_error.

MSVC doesn't seem to provide any is_error_code_enum enumeration for the
windows errors.

Fortunately very few places in llvm have to handle raw windows errors, so
we can just construct the corresponding error_code directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210631 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2014-06-11 03:58:34 +00:00
parent 7456ad1240
commit e5e77d1cd8
5 changed files with 50 additions and 101 deletions

View File

@@ -169,6 +169,10 @@ namespace {
typedef ScopedHandle<FileHandle> FileScopedHandle;
}
static error_code windows_error(unsigned E) {
return error_code(E, system_category());
}
static error_code GetFileNameFromHandle(HANDLE FileHandle,
std::string& Name) {
char Filename[MAX_PATH+1];
@@ -245,7 +249,7 @@ static std::string FindProgram(const std::string &Program, error_code &ec) {
ec = windows_error(::GetLastError());
else if (length > array_lengthof(PathName)) {
// This may have been the file, return with error.
ec = windows_error::buffer_overflow;
ec = windows_error(ERROR_BUFFER_OVERFLOW);
break;
} else {
// We found the path! Return it.