blob: 5b3c884cd78e2c9a2c6df565147913803212dfe6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
//===- llvm/System/Memory.h - Memory Support --------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by Reid Spencer and is distributed under the
// University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file declares the llvm::sys::Memory class.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_SYSTEM_PATH_H
#define LLVM_SYSTEM_PATH_H
#include <string>
namespace llvm {
namespace sys {
/// This class provides an abstraction for various memory handling functions
/// @since 1.4
/// @brief An abstraction for operating system paths.
class Memory {
/// @name Functions
/// @{
public:
Memory() { Address = 0; AllocSize = 0; }
~Memory() { ReleaseRWX(*this); }
/// @throws std::string if an error occurred
static void* AllocateRWX(Memory& block, unsigned NumBytes);
/// @throws std::string if an error occurred
static void ReleaseRWX(Memory& block);
char* base() const { return reinterpret_cast<char*>(Address); }
unsigned size() const { return AllocSize; }
/// @}
/// @name Data
/// @{
private:
void * Address; // Address of first byte of memory area
unsigned AllocSize; // Size, in bytes of the memory area
/// @}
};
}
}
// vim: sw=2
#endif
|