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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210920 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2014-06-13 17:20:48 +00:00
parent 33fe993f2e
commit d8b23109b2
16 changed files with 134 additions and 38 deletions

View File

@ -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 @@ retry_random_path:
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 @@ retry_random_path:
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 create_directories(const Twine &Path, bool IgnoreExisting) {
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