StringList.cpp revision f33f6de54db174aa679a4b6d1e040d37e95541c0
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 15using namespace mcld; 16 17typedef GCFactory<StringList, MCLD_SYMBOLS_PER_INPUT> StringListFactory; 18static llvm::ManagedStatic<StringListFactory> g_StringListFactory; 19 20//===----------------------------------------------------------------------===// 21// StringList 22//===----------------------------------------------------------------------===// 23StringList::StringList() 24{ 25} 26 27StringList::~StringList() 28{ 29} 30 31void StringList::push_back(StrToken* pToken) 32{ 33 m_Tokens.push_back(pToken); 34} 35 36void 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 43StringList* StringList::create() 44{ 45 StringList* result = g_StringListFactory->allocate(); 46 new (result) StringList(); 47 return result; 48} 49 50void StringList::destroy(StringList*& pStringList) 51{ 52 g_StringListFactory->destroy(pStringList); 53 g_StringListFactory->deallocate(pStringList); 54 pStringList = NULL; 55} 56 57void StringList::clear() 58{ 59 g_StringListFactory->clear(); 60} 61