[llvm-commits] CVS: llvm/include/llvm/System/Memory.h
Reid Spencer
reid at x10sys.com
Fri Sep 10 21:21:08 PDT 2004
Changes in directory llvm/include/llvm/System:
Memory.h added (r1.1)
---
Log message:
Initial commit of a file to declare the interface for platform independent
support for various memory allocation operations.
---
Diffs of the changes: (+53 -0)
Index: llvm/include/llvm/System/Memory.h
diff -c /dev/null llvm/include/llvm/System/Memory.h:1.1
*** /dev/null Fri Sep 10 23:21:08 2004
--- llvm/include/llvm/System/Memory.h Fri Sep 10 23:20:58 2004
***************
*** 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
More information about the llvm-commits
mailing list