1 //===- RegionFactory.cpp --------------------------------------------------===// 2 // 3 // The MCLinker Project 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 #include <mcld/Support/RegionFactory.h> 10 #include <mcld/Support/Space.h> 11 12 #include <new> 13 14 using namespace mcld; 15 16 //===----------------------------------------------------------------------===// 17 // RegionFactory 18 //===----------------------------------------------------------------------===// 19 MemoryRegion* 20 RegionFactory::produce(Address pVMAStart, size_t pSize) 21 { 22 MemoryRegion* result = Alloc::allocate(); 23 new (result) MemoryRegion(pVMAStart, pSize); 24 return result; 25 } 26 27 void RegionFactory::destruct(MemoryRegion* pRegion) 28 { 29 destroy(pRegion); 30 deallocate(pRegion); 31 } 32 33