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
13using namespace mcld;
14
15typedef GCFactory<NameSpec, MCLD_SYMBOLS_PER_INPUT> NameSpecFactory;
16static llvm::ManagedStatic<NameSpecFactory> g_NameSpecFactory;
17
18//===----------------------------------------------------------------------===//
19// NameSpec
20//===----------------------------------------------------------------------===//
21NameSpec::NameSpec()
22{
23}
24
25NameSpec::NameSpec(const std::string& pName, bool pAsNeeded)
26  : InputToken(InputToken::NameSpec, pName, pAsNeeded)
27{
28}
29
30NameSpec::~NameSpec()
31{
32}
33
34NameSpec* 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
41void NameSpec::destroy(NameSpec*& pNameSpec)
42{
43  g_NameSpecFactory->destroy(pNameSpec);
44  g_NameSpecFactory->deallocate(pNameSpec);
45  pNameSpec = NULL;
46}
47
48void NameSpec::clear()
49{
50  g_NameSpecFactory->clear();
51}
52