1 //===- NameSpec.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/Script/NameSpec.h" 10 11 #include "mcld/Support/GCFactory.h" 12 13 #include <llvm/Support/ManagedStatic.h> 14 15 namespace mcld { 16 17 typedef GCFactory<NameSpec, MCLD_SYMBOLS_PER_INPUT> NameSpecFactory; 18 static llvm::ManagedStatic<NameSpecFactory> g_NameSpecFactory; 19 20 //===----------------------------------------------------------------------===// 21 // NameSpec 22 //===----------------------------------------------------------------------===// NameSpec()23NameSpec::NameSpec() { 24 } 25 NameSpec(const std::string & pName,bool pAsNeeded)26NameSpec::NameSpec(const std::string& pName, bool pAsNeeded) 27 : InputToken(InputToken::NameSpec, pName, pAsNeeded) { 28 } 29 ~NameSpec()30NameSpec::~NameSpec() { 31 } 32 create(const std::string & pName,bool pAsNeeded)33NameSpec* NameSpec::create(const std::string& pName, bool pAsNeeded) { 34 NameSpec* result = g_NameSpecFactory->allocate(); 35 new (result) NameSpec(pName, pAsNeeded); 36 return result; 37 } 38 destroy(NameSpec * & pNameSpec)39void NameSpec::destroy(NameSpec*& pNameSpec) { 40 g_NameSpecFactory->destroy(pNameSpec); 41 g_NameSpecFactory->deallocate(pNameSpec); 42 pNameSpec = NULL; 43 } 44 clear()45void NameSpec::clear() { 46 g_NameSpecFactory->clear(); 47 } 48 49 } // namespace mcld 50