summaryrefslogtreecommitdiff
path: root/lib/Support/Unix
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-05-31 01:37:45 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-05-31 01:37:45 +0000
commit1bab2d53996ca082150f34d8dafc1968fb5ecba9 (patch)
treec1e2d538aa623bb0de93b37a36327a0d6ef2c1de /lib/Support/Unix
parentbfe17408a9bcad9cbb29ff0dafb8a7674a7c09a6 (diff)
downloadllvm-1bab2d53996ca082150f34d8dafc1968fb5ecba9.tar.gz
llvm-1bab2d53996ca082150f34d8dafc1968fb5ecba9.tar.bz2
llvm-1bab2d53996ca082150f34d8dafc1968fb5ecba9.tar.xz
Use error_code() instead of error_code::succes()
There is no std::error_code::success, so this removes much of the noise in transitioning to std::error_code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209952 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Unix')
-rw-r--r--lib/Support/Unix/Memory.inc10
-rw-r--r--lib/Support/Unix/Path.inc42
-rw-r--r--lib/Support/Unix/Process.inc2
3 files changed, 27 insertions, 27 deletions
diff --git a/lib/Support/Unix/Memory.inc b/lib/Support/Unix/Memory.inc
index 23b49b75fa..7e02244c72 100644
--- a/lib/Support/Unix/Memory.inc
+++ b/lib/Support/Unix/Memory.inc
@@ -84,7 +84,7 @@ Memory::allocateMappedMemory(size_t NumBytes,
const MemoryBlock *const NearBlock,
unsigned PFlags,
error_code &EC) {
- EC = error_code::success();
+ EC = error_code();
if (NumBytes == 0)
return MemoryBlock();
@@ -140,7 +140,7 @@ Memory::allocateMappedMemory(size_t NumBytes,
error_code
Memory::releaseMappedMemory(MemoryBlock &M) {
if (M.Address == nullptr || M.Size == 0)
- return error_code::success();
+ return error_code();
if (0 != ::munmap(M.Address, M.Size))
return error_code(errno, system_category());
@@ -148,13 +148,13 @@ Memory::releaseMappedMemory(MemoryBlock &M) {
M.Address = nullptr;
M.Size = 0;
- return error_code::success();
+ return error_code();
}
error_code
Memory::protectMappedMemory(const MemoryBlock &M, unsigned Flags) {
if (M.Address == nullptr || M.Size == 0)
- return error_code::success();
+ return error_code();
if (!Flags)
return error_code(EINVAL, generic_category());
@@ -168,7 +168,7 @@ Memory::protectMappedMemory(const MemoryBlock &M, unsigned Flags) {
if (Flags & MF_EXEC)
Memory::InvalidateInstructionCache(M.Address, M.Size);
- return error_code::success();
+ return error_code();
}
/// AllocateRWX - Allocate a slab of memory with read/write/execute
diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc
index c36c865451..2925e6457a 100644
--- a/lib/Support/Unix/Path.inc
+++ b/lib/Support/Unix/Path.inc
@@ -100,7 +100,7 @@ static error_code TempDir(SmallVectorImpl<char> &result) {
result.clear();
StringRef d(dir);
result.append(d.begin(), d.end());
- return error_code::success();
+ return error_code();
}
namespace llvm {
@@ -235,7 +235,7 @@ error_code current_path(SmallVectorImpl<char> &result) {
!llvm::sys::fs::status(".", DotStatus) &&
PWDStatus.getUniqueID() == DotStatus.getUniqueID()) {
result.append(pwd, pwd + strlen(pwd));
- return error_code::success();
+ return error_code();
}
#ifdef MAXPATHLEN
@@ -257,7 +257,7 @@ error_code current_path(SmallVectorImpl<char> &result) {
}
result.set_size(strlen(result.data()));
- return error_code::success();
+ return error_code();
}
error_code create_directory(const Twine &path, bool IgnoreExisting) {
@@ -269,7 +269,7 @@ error_code create_directory(const Twine &path, bool IgnoreExisting) {
return error_code(errno, system_category());
}
- return error_code::success();
+ return error_code();
}
error_code normalize_separators(SmallVectorImpl<char> &Path) {
@@ -282,7 +282,7 @@ error_code normalize_separators(SmallVectorImpl<char> &Path) {
*PI = '/';
}
}
- return error_code::success();
+ return error_code();
}
// Note that we are using symbolic link because hard links are not supported by
@@ -297,7 +297,7 @@ error_code create_link(const Twine &to, const Twine &from) {
if (::symlink(t.begin(), f.begin()) == -1)
return error_code(errno, system_category());
- return error_code::success();
+ return error_code();
}
error_code remove(const Twine &path, bool IgnoreNonExisting) {
@@ -308,7 +308,7 @@ error_code remove(const Twine &path, bool IgnoreNonExisting) {
if (lstat(p.begin(), &buf) != 0) {
if (errno != errc::no_such_file_or_directory || !IgnoreNonExisting)
return error_code(errno, system_category());
- return error_code::success();
+ return error_code();
}
// Note: this check catches strange situations. In all cases, LLVM should
@@ -324,7 +324,7 @@ error_code remove(const Twine &path, bool IgnoreNonExisting) {
return error_code(errno, system_category());
}
- return error_code::success();
+ return error_code();
}
error_code rename(const Twine &from, const Twine &to) {
@@ -337,7 +337,7 @@ error_code rename(const Twine &from, const Twine &to) {
if (::rename(f.begin(), t.begin()) == -1)
return error_code(errno, system_category());
- return error_code::success();
+ return error_code();
}
error_code resize_file(const Twine &path, uint64_t size) {
@@ -347,7 +347,7 @@ error_code resize_file(const Twine &path, uint64_t size) {
if (::truncate(p.begin(), size) == -1)
return error_code(errno, system_category());
- return error_code::success();
+ return error_code();
}
error_code exists(const Twine &path, bool &result) {
@@ -361,7 +361,7 @@ error_code exists(const Twine &path, bool &result) {
} else
result = true;
- return error_code::success();
+ return error_code();
}
bool can_write(const Twine &Path) {
@@ -395,7 +395,7 @@ error_code equivalent(const Twine &A, const Twine &B, bool &result) {
if (error_code ec = status(A, fsA)) return ec;
if (error_code ec = status(B, fsB)) return ec;
result = equivalent(fsA, fsB);
- return error_code::success();
+ return error_code();
}
static error_code fillStatus(int StatRet, const struct stat &Status,
@@ -429,7 +429,7 @@ static error_code fillStatus(int StatRet, const struct stat &Status,
file_status(Type, Perms, Status.st_dev, Status.st_ino, Status.st_mtime,
Status.st_uid, Status.st_gid, Status.st_size);
- return error_code::success();
+ return error_code();
}
error_code status(const Twine &Path, file_status &Result) {
@@ -455,7 +455,7 @@ error_code setLastModificationAndAccessTime(int FD, TimeValue Time) {
Times[1] = Times[0];
if (::futimens(FD, Times))
return error_code(errno, system_category());
- return error_code::success();
+ return error_code();
#elif defined(HAVE_FUTIMES)
timeval Times[2];
Times[0].tv_sec = Time.toEpochTime();
@@ -463,7 +463,7 @@ error_code setLastModificationAndAccessTime(int FD, TimeValue Time) {
Times[1] = Times[0];
if (::futimes(FD, Times))
return error_code(errno, system_category());
- return error_code::success();
+ return error_code();
#else
#warning Missing futimes() and futimens()
return make_error_code(errc::not_supported);
@@ -497,7 +497,7 @@ error_code mapped_file_region::init(int FD, bool CloseFD, uint64_t Offset) {
Mapping = ::mmap(nullptr, Size, prot, flags, FD, Offset);
if (Mapping == MAP_FAILED)
return error_code(errno, system_category());
- return error_code::success();
+ return error_code();
}
mapped_file_region::mapped_file_region(const Twine &path,
@@ -602,7 +602,7 @@ error_code detail::directory_iterator_destruct(detail::DirIterState &it) {
::closedir(reinterpret_cast<DIR *>(it.IterationHandle));
it.IterationHandle = 0;
it.CurrentEntry = directory_entry();
- return error_code::success();
+ return error_code();
}
error_code detail::directory_iterator_increment(detail::DirIterState &it) {
@@ -619,7 +619,7 @@ error_code detail::directory_iterator_increment(detail::DirIterState &it) {
} else
return directory_iterator_destruct(it);
- return error_code::success();
+ return error_code();
}
error_code get_magic(const Twine &path, uint32_t len,
@@ -650,7 +650,7 @@ error_code get_magic(const Twine &path, uint32_t len,
}
std::fclose(file);
result.set_size(size);
- return error_code::success();
+ return error_code();
}
error_code openFileForRead(const Twine &Name, int &ResultFD) {
@@ -660,7 +660,7 @@ error_code openFileForRead(const Twine &Name, int &ResultFD) {
if (errno != EINTR)
return error_code(errno, system_category());
}
- return error_code::success();
+ return error_code();
}
error_code openFileForWrite(const Twine &Name, int &ResultFD,
@@ -690,7 +690,7 @@ error_code openFileForWrite(const Twine &Name, int &ResultFD,
if (errno != EINTR)
return error_code(errno, system_category());
}
- return error_code::success();
+ return error_code();
}
} // end namespace fs
diff --git a/lib/Support/Unix/Process.inc b/lib/Support/Unix/Process.inc
index 8faa638ec8..d927bb539e 100644
--- a/lib/Support/Unix/Process.inc
+++ b/lib/Support/Unix/Process.inc
@@ -195,7 +195,7 @@ error_code Process::GetArgumentVector(SmallVectorImpl<const char *> &ArgsOut,
SpecificBumpPtrAllocator<char> &) {
ArgsOut.append(ArgsIn.begin(), ArgsIn.end());
- return error_code::success();
+ return error_code();
}
bool Process::StandardInIsUserInput() {