Use std::error_code instead of llvm::error_code.
[oota-llvm.git] / utils / KillTheDoctor / KillTheDoctor.cpp
index f236c5ffc9e8088bc8a18dd1db8509cbb91dfd95..2b66066b43a591f95b00b3626b2d1821db751fbc 100644 (file)
@@ -43,6 +43,7 @@
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/system_error.h"
 #include "llvm/Support/type_traits.h"
+#include "llvm/Support/WindowsError.h"
 #include <algorithm>
 #include <cerrno>
 #include <cstdlib>
@@ -169,9 +170,7 @@ namespace {
   typedef ScopedHandle<FileHandle>              FileScopedHandle;
 }
 
-static error_code windows_error(unsigned E) {
-  return error_code(E, system_category());
-}
+static error_code windows_error(DWORD E) { return mapWindowsError(E); }
 
 static error_code GetFileNameFromHandle(HANDLE FileHandle,
                                         std::string& Name) {
@@ -426,7 +425,7 @@ int main(int argc, char **argv) {
     if (!success) {
       ec = windows_error(::GetLastError());
 
-      if (ec == errc::timed_out) {
+      if (ec == std::errc::timed_out) {
         errs() << ToolName << ": Process timed out.\n";
         ::TerminateProcess(ProcessInfo.hProcess, -1);
         // Otherwise other stuff starts failing...