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