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