summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Unix/Memory.inc
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-06-13 02:24:39 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-06-13 02:24:39 +0000
commitdb4ed0bdabc9f61fbd373be416375e38bf1acb27 (patch)
tree0efbd2559140b336f68d1a7528dcc64add57602d /llvm/lib/Support/Unix/Memory.inc
parent3453bcf64d394b109ccab19915ba2fa40feeb59b (diff)
downloadbcm5719-llvm-db4ed0bdabc9f61fbd373be416375e38bf1acb27.tar.gz
bcm5719-llvm-db4ed0bdabc9f61fbd373be416375e38bf1acb27.zip
Remove 'using std::errro_code' from lib.
llvm-svn: 210871
Diffstat (limited to 'llvm/lib/Support/Unix/Memory.inc')
-rw-r--r--llvm/lib/Support/Unix/Memory.inc27
1 files changed, 13 insertions, 14 deletions
diff --git a/llvm/lib/Support/Unix/Memory.inc b/llvm/lib/Support/Unix/Memory.inc
index cca37829497..c9d89a82474 100644
--- a/llvm/lib/Support/Unix/Memory.inc
+++ b/llvm/lib/Support/Unix/Memory.inc
@@ -37,7 +37,6 @@ extern "C" void sys_icache_invalidate(const void *Addr, size_t len);
#else
extern "C" void __clear_cache(void *, void*);
#endif
-using std::error_code;
namespace {
@@ -84,8 +83,8 @@ MemoryBlock
Memory::allocateMappedMemory(size_t NumBytes,
const MemoryBlock *const NearBlock,
unsigned PFlags,
- error_code &EC) {
- EC = error_code();
+ std::error_code &EC) {
+ EC = std::error_code();
if (NumBytes == 0)
return MemoryBlock();
@@ -96,7 +95,7 @@ Memory::allocateMappedMemory(size_t NumBytes,
#ifdef NEED_DEV_ZERO_FOR_MMAP
static int zero_fd = open("/dev/zero", O_RDWR);
if (zero_fd == -1) {
- EC = error_code(errno, std::generic_category());
+ EC = std::error_code(errno, std::generic_category());
return MemoryBlock();
}
fd = zero_fd;
@@ -124,7 +123,7 @@ Memory::allocateMappedMemory(size_t NumBytes,
if (NearBlock) //Try again without a near hint
return allocateMappedMemory(NumBytes, nullptr, PFlags, EC);
- EC = error_code(errno, std::generic_category());
+ EC = std::error_code(errno, std::generic_category());
return MemoryBlock();
}
@@ -138,38 +137,38 @@ Memory::allocateMappedMemory(size_t NumBytes,
return Result;
}
-error_code
+std::error_code
Memory::releaseMappedMemory(MemoryBlock &M) {
if (M.Address == nullptr || M.Size == 0)
- return error_code();
+ return std::error_code();
if (0 != ::munmap(M.Address, M.Size))
- return error_code(errno, std::generic_category());
+ return std::error_code(errno, std::generic_category());
M.Address = nullptr;
M.Size = 0;
- return error_code();
+ return std::error_code();
}
-error_code
+std::error_code
Memory::protectMappedMemory(const MemoryBlock &M, unsigned Flags) {
if (M.Address == nullptr || M.Size == 0)
- return error_code();
+ return std::error_code();
if (!Flags)
- return error_code(EINVAL, std::generic_category());
+ return std::error_code(EINVAL, std::generic_category());
int Protect = getPosixProtectionFlags(Flags);
int Result = ::mprotect(M.Address, M.Size, Protect);
if (Result != 0)
- return error_code(errno, std::generic_category());
+ return std::error_code(errno, std::generic_category());
if (Flags & MF_EXEC)
Memory::InvalidateInstructionCache(M.Address, M.Size);
- return error_code();
+ return std::error_code();
}
/// AllocateRWX - Allocate a slab of memory with read/write/execute
OpenPOWER on IntegriCloud