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