Finishing touch for the std::error_code transition.
While std::error_code itself seems to work OK in all platforms, there
are few annoying differences with regards to the std::errc enumeration.
This patch adds a simple llvm enumeration, which will hopefully avoid build
breakages in other platforms and surprises as we get more uses of
std::error_code.
llvm-svn: 210920
diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp
index 1f843d8..15edf0dd 100644
--- a/llvm/lib/Support/Path.cpp
+++ b/llvm/lib/Support/Path.cpp
@@ -11,6 +11,7 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/Support/Errc.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/ErrorHandling.h"
@@ -204,7 +205,7 @@
if (std::error_code EC =
sys::fs::openFileForWrite(Twine(ResultPath.begin()), ResultFD,
sys::fs::F_RW | sys::fs::F_Excl, Mode)) {
- if (EC == std::errc::file_exists)
+ if (EC == errc::file_exists)
goto retry_random_path;
return EC;
}
@@ -225,7 +226,7 @@
case FS_Dir: {
if (std::error_code EC =
sys::fs::create_directory(ResultPath.begin(), false)) {
- if (EC == std::errc::file_exists)
+ if (EC == errc::file_exists)
goto retry_random_path;
return EC;
}
@@ -830,7 +831,7 @@
std::error_code EC = create_directory(P, IgnoreExisting);
// If we succeeded, or had any error other than the parent not existing, just
// return it.
- if (EC != std::errc::no_such_file_or_directory)
+ if (EC != errc::no_such_file_or_directory)
return EC;
// We failed because of a no_such_file_or_directory, try to create the