Home | History | Annotate | Download | only in Support
      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:
     43     PositionDependentOption(unsigned pPosition, Type pType)
     44       : m_Type(pType),
     45         m_Position(pPosition) {}
     46 
     47   public:
     48     inline const Type& type() const
     49     { return m_Type; }
     50 
     51     inline unsigned position() const
     52     { return m_Position; }
     53 
     54   private:
     55     Type m_Type;
     56     unsigned m_Position;
     57   };
     58 
     59   typedef std::vector<PositionDependentOption*> PositionDependentOptions;
     60 } // namespace of mcld
     61 
     62 #endif
     63 
     64