• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- StringList.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/StringList.h>
10 #include <mcld/Script/StrToken.h>
11 #include <mcld/Support/raw_ostream.h>
12 #include <mcld/Support/GCFactory.h>
13 #include <llvm/Support/ManagedStatic.h>
14 
15 using namespace mcld;
16 
17 typedef GCFactory<StringList, MCLD_SYMBOLS_PER_INPUT> StringListFactory;
18 static llvm::ManagedStatic<StringListFactory> g_StringListFactory;
19 
20 //===----------------------------------------------------------------------===//
21 // StringList
22 //===----------------------------------------------------------------------===//
StringList()23 StringList::StringList()
24 {
25 }
26 
~StringList()27 StringList::~StringList()
28 {
29 }
30 
push_back(StrToken * pToken)31 void StringList::push_back(StrToken* pToken)
32 {
33   m_Tokens.push_back(pToken);
34 }
35 
dump() const36 void StringList::dump() const
37 {
38   for (const_iterator it = begin(), ie = end(); it != ie; ++it)
39     mcld::outs() << (*it)->name() << "\t";
40   mcld::outs() << "\n";
41 }
42 
create()43 StringList* StringList::create()
44 {
45   StringList* result = g_StringListFactory->allocate();
46   new (result) StringList();
47   return result;
48 }
49 
destroy(StringList * & pStringList)50 void StringList::destroy(StringList*& pStringList)
51 {
52   g_StringListFactory->destroy(pStringList);
53   g_StringListFactory->deallocate(pStringList);
54   pStringList = NULL;
55 }
56 
clear()57 void StringList::clear()
58 {
59   g_StringListFactory->clear();
60 }
61