blob: 3a35f4e0bea2b3d8238531812980bd3953c82bd0 [file] [log] [blame]
//===- MemoryRegion.cpp ---------------------------------------------------===//
//
// The MCLinker Project
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include <mcld/Support/MemoryRegion.h>
using namespace mcld;
//==========================
// MemoryRegion
MemoryRegion::MemoryRegion(MemoryArea::Space *pParentSpace,
const MemoryRegion::Address pVMAStart,
size_t pSize)
: m_pParentSpace(pParentSpace), m_VMAStart(pVMAStart), m_Length(pSize) {
m_pParentSpace->region_num++;
}
MemoryRegion::~MemoryRegion()
{
drift();
}
void MemoryRegion::drift()
{
if (NULL == m_pParentSpace)
return;
m_pParentSpace->region_num--;
m_pParentSpace = NULL;
}