aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-09-11 04:20:58 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-09-11 04:20:58 +0000
commite5d6ca43d71e9e541d2b515c954406cb9a199446 (patch)
treef1832d27b1dd97af7f2df2623ed33812dee15baa
parente6a10cf518838ec8ff06ad6c2e32860670e57edc (diff)
Initial commit of a file to declare the interface for platform independent
support for various memory allocation operations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16279 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/System/Memory.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/include/llvm/System/Memory.h b/include/llvm/System/Memory.h
new file mode 100644
index 0000000000..5b3c884cd7
--- /dev/null
+++ b/include/llvm/System/Memory.h
@@ -0,0 +1,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