• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- PositionDependentOption.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_POSITIONDEPENDENTOPTION_H
10 #define MCLD_POSITIONDEPENDENTOPTION_H
11 #ifdef ENABLE_UNITTEST
12 #include <gtest.h>
13 #endif
14 
15 #include <vector>
16 
17 namespace mcld
18 {
19 
20   /** \class PositionDependentOption
21    *  \brief PositionDependentOptions converts LLVM options into MCLDInfo
22    */
23   class PositionDependentOption
24   {
25   public:
26     enum Type {
27       BITCODE,
28       NAMESPEC,
29       INPUT_FILE,
30       START_GROUP,
31       END_GROUP,
32       WHOLE_ARCHIVE,
33       NO_WHOLE_ARCHIVE,
34       AS_NEEDED,
35       NO_AS_NEEDED,
36       ADD_NEEDED,
37       NO_ADD_NEEDED,
38       BDYNAMIC,
39       BSTATIC
40     };
41 
42   protected:
PositionDependentOption(unsigned int pPosition,Type pType)43     PositionDependentOption(unsigned int pPosition, Type pType)
44       : m_Type(pType),
45         m_Position(pPosition) {}
46 
47   public:
type()48     Type type()
49     { return m_Type; }
50 
type()51     Type type() const
52     { return m_Type; }
53 
position()54     unsigned int position()
55     { return m_Position; }
56 
position()57     unsigned int position() const
58     { return m_Position; }
59 
60   private:
61     Type m_Type;
62     unsigned int m_Position;
63   };
64 
65   typedef std::vector<PositionDependentOption*> PositionDependentOptions;
66 } // namespace of mcld
67 
68 #endif
69 
70