• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- GroupReader.h ------------------------------------------------------===//
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 #ifndef MCLD_GROUPREADER_H
10 #define MCLD_GROUPREADER_H
11 #ifdef ENABLE_UNITTEST
12 #include <gtest.h>
13 #endif
14 
15 #include <mcld/Module.h>
16 
17 namespace mcld
18 {
19 class Archive;
20 class ArchiveReader;
21 class DynObjReader;
22 class LinkerConfig;
23 class ObjectReader;
24 class BinaryReader;
25 
26 /** \class GroupReader
27  *  \brief GroupReader handles the Group Node in InputTree
28  *
29  *  Group Node is the root of sub-tree in InputTree which includes the iputs in
30  *  the command line options --start-group and --end-group options
31  */
32 class GroupReader
33 {
34 public:
35   GroupReader(Module& pModule,
36               ObjectReader& pObjectReader,
37               DynObjReader& pDynObjReader,
38               ArchiveReader& pArchiveReader,
39               BinaryReader& pBinaryReader);
40 
41   ~GroupReader();
42 
43   /// readGroup - handle the input sub-tree wich its root is pRoot
44   /// @param pRoot - the root Group node of the sub-tree
45   bool readGroup(Module::input_iterator pRoot,
46                  InputBuilder& pBuilder,
47                  const LinkerConfig& pConfig);
48 
49 private:
50   /// ArchiveListEntry - record the Archive and the corresponding input iterator
51   /// of the archive node
52   struct ArchiveListEntry {
ArchiveListEntryArchiveListEntry53     ArchiveListEntry(Archive& pArchive, Module::input_iterator pIterator)
54       : archive(pArchive), input(pIterator) {
55     }
56     Archive& archive;
57     Module::input_iterator input;
58   };
59 
60 private:
61   Module& m_Module;
62   ObjectReader& m_ObjectReader;
63   DynObjReader& m_DynObjReader;
64   ArchiveReader& m_ArchiveReader;
65   BinaryReader& m_BinaryReader;
66 };
67 
68 } // namespace of mcld
69 
70 #endif
71 
72