1//===- InputSymbolTable.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/LD/InputSymbolTable.h"
10#include <vector>
11
12using namespace mcld;
13
14//==========================
15// InputSymbolTable
16
17InputSymbolTable::InputSymbolTable(StrSymPool &pStrSymPool,
18                                   size_t pNumOfSymbols,
19                                   StringTable &pEntireStringTable,
20                                   StringTable &pDynamicStringTable)
21  : SymbolTableIF(pStrSymPool)
22{
23  f_StrSymPool.addIndirectClient(*this);
24
25  f_pCategorySet->at(CategorySet::Entire).reserve(pNumOfSymbols);
26
27  f_pCategorySet->at(CategorySet::Entire).interpose(&pEntireStringTable);
28  f_pCategorySet->at(CategorySet::Dynamic).interpose(&pDynamicStringTable);
29}
30
31void InputSymbolTable::doInsertSymbol(LDSymbol *pSym)
32{
33  f_pCategorySet->insertSymbolPointer(pSym);
34}
35
36void InputSymbolTable::doMerge(const SymbolTableIF &pSymTab)
37{
38  if (this == &pSymTab)
39     return;
40  for (size_t i = 0; i < CategorySet::NumOfCategories; ++i)
41    f_pCategorySet->at(i).insert(f_pCategorySet->at(i).end(),
42                                 pSymTab.begin(i),
43                                 pSymTab.end(i));
44}
45
46InputSymbolTable::~InputSymbolTable()
47{
48}
49