summaryrefslogtreecommitdiff
path: root/lib/Support
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support')
-rw-r--r--lib/Support/FileOutputBuffer.cpp3
-rw-r--r--lib/Support/LockFileManager.cpp5
-rw-r--r--lib/Support/MemoryBuffer.cpp3
-rw-r--r--lib/Support/Path.cpp7
-rw-r--r--lib/Support/Unix/Path.inc10
-rw-r--r--lib/Support/Windows/Path.inc14
-rw-r--r--lib/Support/WindowsError.cpp6
-rw-r--r--lib/Support/YAMLTraits.cpp7
8 files changed, 30 insertions, 25 deletions
diff --git a/lib/Support/FileOutputBuffer.cpp b/lib/Support/FileOutputBuffer.cpp
index 8a7b0d73f9..2e740ca045 100644
--- a/lib/Support/FileOutputBuffer.cpp
+++ b/lib/Support/FileOutputBuffer.cpp
@@ -11,6 +11,7 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/Support/Errc.h"
#include "llvm/Support/FileOutputBuffer.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/raw_ostream.h"
@@ -51,7 +52,7 @@ FileOutputBuffer::create(StringRef FilePath, size_t Size,
if (EC)
return EC;
else
- return std::make_error_code(std::errc::operation_not_permitted);
+ return make_error_code(errc::operation_not_permitted);
}
// Delete target file.
diff --git a/lib/Support/LockFileManager.cpp b/lib/Support/LockFileManager.cpp
index 0ca631cb63..681bae2ba1 100644
--- a/lib/Support/LockFileManager.cpp
+++ b/lib/Support/LockFileManager.cpp
@@ -9,6 +9,7 @@
#include "llvm/Support/LockFileManager.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/Errc.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
@@ -112,7 +113,7 @@ LockFileManager::LockFileManager(StringRef FileName)
if (Out.has_error()) {
// We failed to write out PID, so make up an excuse, remove the
// unique lock file, and fail.
- Error = std::make_error_code(std::errc::no_space_on_device);
+ Error = make_error_code(errc::no_space_on_device);
sys::fs::remove(UniqueLockFileName.c_str());
return;
}
@@ -125,7 +126,7 @@ LockFileManager::LockFileManager(StringRef FileName)
if (!EC)
return;
- if (EC != std::errc::file_exists) {
+ if (EC != errc::file_exists) {
Error = EC;
return;
}
diff --git a/lib/Support/MemoryBuffer.cpp b/lib/Support/MemoryBuffer.cpp
index 8ff4e7c4dc..abf4f60b27 100644
--- a/lib/Support/MemoryBuffer.cpp
+++ b/lib/Support/MemoryBuffer.cpp
@@ -14,6 +14,7 @@
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Config/config.h"
+#include "llvm/Support/Errc.h"
#include "llvm/Support/Errno.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MathExtras.h"
@@ -364,7 +365,7 @@ static std::error_code getOpenFileImpl(int FD, const char *Filename,
if (!Buf) {
// Failed to create a buffer. The only way it can fail is if
// new(std::nothrow) returns 0.
- return std::make_error_code(std::errc::not_enough_memory);
+ return make_error_code(errc::not_enough_memory);
}
std::unique_ptr<MemoryBuffer> SB(Buf);
diff --git a/lib/Support/Path.cpp b/lib/Support/Path.cpp
index 1f843d8f2a..15edf0ddbb 100644
--- a/lib/Support/Path.cpp
+++ b/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 @@ 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
diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc
index 824673649c..c9fae42986 100644
--- a/lib/Support/Unix/Path.inc
+++ b/lib/Support/Unix/Path.inc
@@ -317,7 +317,7 @@ std::error_code remove(const Twine &path, bool IgnoreNonExisting) {
// effectively prevents LLVM from erasing things like /dev/null, any block
// special file, or other things that aren't "regular" files.
if (!S_ISREG(buf.st_mode) && !S_ISDIR(buf.st_mode) && !S_ISLNK(buf.st_mode))
- return make_error_code(std::errc::operation_not_permitted);
+ return make_error_code(errc::operation_not_permitted);
if (::remove(p.begin()) == -1) {
if (errno != ENOENT || !IgnoreNonExisting)
@@ -404,7 +404,7 @@ static std::error_code fillStatus(int StatRet, const struct stat &Status,
file_status &Result) {
if (StatRet != 0) {
std::error_code ec(errno, std::generic_category());
- if (ec == std::errc::no_such_file_or_directory)
+ if (ec == errc::no_such_file_or_directory)
Result = file_status(file_type::file_not_found);
else
Result = file_status(file_type::status_error);
@@ -468,7 +468,7 @@ std::error_code setLastModificationAndAccessTime(int FD, TimeValue Time) {
return std::error_code();
#else
#warning Missing futimes() and futimens()
- return make_error_code(std::errc::not_supported);
+ return make_error_code(errc::not_supported);
#endif
}
@@ -512,7 +512,7 @@ mapped_file_region::mapped_file_region(const Twine &path,
, Mapping() {
// Make sure that the requested size fits within SIZE_T.
if (length > std::numeric_limits<size_t>::max()) {
- ec = make_error_code(std::errc::invalid_argument);
+ ec = make_error_code(errc::invalid_argument);
return;
}
@@ -541,7 +541,7 @@ mapped_file_region::mapped_file_region(int fd,
, Mapping() {
// Make sure that the requested size fits within SIZE_T.
if (length > std::numeric_limits<size_t>::max()) {
- ec = make_error_code(std::errc::invalid_argument);
+ ec = make_error_code(errc::invalid_argument);
return;
}
diff --git a/lib/Support/Windows/Path.inc b/lib/Support/Windows/Path.inc
index 72f21ae5e6..7a1bc0447f 100644
--- a/lib/Support/Windows/Path.inc
+++ b/lib/Support/Windows/Path.inc
@@ -196,7 +196,7 @@ std::error_code remove(const Twine &path, bool IgnoreNonExisting) {
file_status ST;
if (std::error_code EC = status(path, ST)) {
- if (EC != std::errc::no_such_file_or_directory || !IgnoreNonExisting)
+ if (EC != errc::no_such_file_or_directory || !IgnoreNonExisting)
return EC;
return std::error_code();
}
@@ -208,14 +208,14 @@ std::error_code remove(const Twine &path, bool IgnoreNonExisting) {
if (ST.type() == file_type::directory_file) {
if (!::RemoveDirectoryW(c_str(path_utf16))) {
std::error_code EC = windows_error(::GetLastError());
- if (EC != std::errc::no_such_file_or_directory || !IgnoreNonExisting)
+ if (EC != errc::no_such_file_or_directory || !IgnoreNonExisting)
return EC;
}
return std::error_code();
}
if (!::DeleteFileW(c_str(path_utf16))) {
std::error_code EC = windows_error(::GetLastError());
- if (EC != std::errc::no_such_file_or_directory || !IgnoreNonExisting)
+ if (EC != errc::no_such_file_or_directory || !IgnoreNonExisting)
return EC;
}
return std::error_code();
@@ -481,7 +481,7 @@ std::error_code mapped_file_region::init(int FD, bool CloseFD, uint64_t Offset)
_close(FileDescriptor);
} else
::CloseHandle(FileHandle);
- return std::make_error_code(std::errc::invalid_argument);
+ return make_error_code(errc::invalid_argument);
}
DWORD flprotect;
@@ -617,7 +617,7 @@ mapped_file_region::mapped_file_region(int fd,
if (closefd)
_close(FileDescriptor);
FileDescriptor = 0;
- ec = std::make_error_code(std::errc::bad_file_descriptor);
+ ec = make_error_code(errc::bad_file_descriptor);
return;
}
@@ -779,7 +779,7 @@ std::error_code openFileForRead(const Twine &Name, int &ResultFD) {
if (LastError != ERROR_ACCESS_DENIED)
return EC;
if (is_directory(Name))
- return std::make_error_code(std::errc::is_a_directory);
+ return make_error_code(errc::is_a_directory);
return EC;
}
@@ -831,7 +831,7 @@ std::error_code openFileForWrite(const Twine &Name, int &ResultFD,
if (LastError != ERROR_ACCESS_DENIED)
return EC;
if (is_directory(Name))
- return std::make_error_code(std::errc::is_a_directory);
+ return make_error_code(errc::is_a_directory);
return EC;
}
diff --git a/lib/Support/WindowsError.cpp b/lib/Support/WindowsError.cpp
index e54ac36314..18fdbbda9f 100644
--- a/lib/Support/WindowsError.cpp
+++ b/lib/Support/WindowsError.cpp
@@ -12,12 +12,12 @@
// errors to generic ones. The one implemented in msvc is too conservative
// for llvm, so we do an extra mapping when constructing an error_code
// from an windows error. This allows the rest of llvm to simple checks
-// like "EC == std::errc::file_exists" and have it work on both posix and
+// like "EC == errc::file_exists" and have it work on both posix and
// windows.
//
//===----------------------------------------------------------------------===//
-
+#include "llvm/Support/Errc.h"
#include "llvm/Support/WindowsError.h"
#include "llvm/Config/llvm-config.h"
@@ -30,7 +30,7 @@
// I'd rather not double the line count of the following.
#define MAP_ERR_TO_COND(x, y) \
case x: \
- return std::make_error_code(std::errc::y)
+ return make_error_code(errc::y)
std::error_code llvm::mapWindowsError(unsigned EV) {
switch (EV) {
diff --git a/lib/Support/YAMLTraits.cpp b/lib/Support/YAMLTraits.cpp
index 0bf9cf8908..5212624f0c 100644
--- a/lib/Support/YAMLTraits.cpp
+++ b/lib/Support/YAMLTraits.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/Support/Errc.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/Casting.h"
@@ -72,7 +73,7 @@ bool Input::setCurrentDocument() {
Node *N = DocIterator->getRoot();
if (!N) {
assert(Strm->failed() && "Root is NULL iff parsing failed");
- EC = std::make_error_code(std::errc::invalid_argument);
+ EC = make_error_code(errc::invalid_argument);
return false;
}
@@ -122,7 +123,7 @@ bool Input::preflightKey(const char *Key, bool Required, bool, bool &UseDefault,
// nodes are present.
if (!CurrentNode) {
if (Required)
- EC = std::make_error_code(std::errc::invalid_argument);
+ EC = make_error_code(errc::invalid_argument);
return false;
}
@@ -298,7 +299,7 @@ void Input::setError(HNode *hnode, const Twine &message) {
void Input::setError(Node *node, const Twine &message) {
Strm->printError(node, message);
- EC = std::make_error_code(std::errc::invalid_argument);
+ EC = make_error_code(errc::invalid_argument);
}
Input::HNode *Input::createHNodes(Node *N) {