Home | History | Annotate | Download | only in MC
      1 //===- CommandAction.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_MC_COMMAND_ACTION_H
     10 #define MCLD_MC_COMMAND_ACTION_H
     11 #ifdef ENABLE_UNITTEST
     12 #include <gtest.h>
     13 #endif
     14 
     15 #include <string>
     16 #include <mcld/Support/Path.h>
     17 #include <mcld/MC/InputAction.h>
     18 
     19 namespace mcld {
     20 
     21 class SearchDirs;
     22 class InputBuilder;
     23 
     24 //===----------------------------------------------------------------------===//
     25 // Derived InputAction
     26 //===----------------------------------------------------------------------===//
     27 /// InputFileAction
     28 class InputFileAction : public InputAction
     29 {
     30 public:
     31   explicit InputFileAction(unsigned int pPosition, const sys::fs::Path &pPath);
     32 
     33   const sys::fs::Path& path() const { return m_Path; }
     34 
     35   bool activate(InputBuilder&) const;
     36 
     37 private:
     38   sys::fs::Path m_Path;
     39 };
     40 
     41 /// NamespecAction
     42 class NamespecAction : public InputAction
     43 {
     44 public:
     45   NamespecAction(unsigned int pPosition,
     46                  const std::string &pNamespec,
     47                  SearchDirs& pSearchDirs);
     48 
     49   const std::string &namespec() const { return m_Namespec; }
     50 
     51   bool activate(InputBuilder&) const;
     52 
     53 private:
     54   std::string m_Namespec;
     55   SearchDirs& m_SearchDirs;
     56 };
     57 
     58 /// BitcodeAction
     59 class BitcodeAction : public InputAction
     60 {
     61 public:
     62   BitcodeAction(unsigned int pPosition, const sys::fs::Path &pPath);
     63 
     64   const sys::fs::Path& path() const { return m_Path; }
     65 
     66   bool activate(InputBuilder&) const;
     67 
     68 private:
     69   sys::fs::Path m_Path;
     70 };
     71 
     72 /// StartGroupAction
     73 class StartGroupAction : public InputAction
     74 {
     75 public:
     76   explicit StartGroupAction(unsigned int pPosition);
     77 
     78   bool activate(InputBuilder&) const;
     79 };
     80 
     81 /// EndGroupAction
     82 class EndGroupAction : public InputAction
     83 {
     84 public:
     85   explicit EndGroupAction(unsigned int pPosition);
     86 
     87   bool activate(InputBuilder&) const;
     88 };
     89 
     90 /// WholeArchiveAction
     91 class WholeArchiveAction : public InputAction
     92 {
     93 public:
     94   explicit WholeArchiveAction(unsigned int pPosition);
     95 
     96   bool activate(InputBuilder&) const;
     97 };
     98 
     99 /// NoWholeArchiveAction
    100 class NoWholeArchiveAction : public InputAction
    101 {
    102 public:
    103   explicit NoWholeArchiveAction(unsigned int pPosition);
    104 
    105   bool activate(InputBuilder&) const;
    106 };
    107 
    108 /// AsNeededAction
    109 class AsNeededAction : public InputAction
    110 {
    111 public:
    112   explicit AsNeededAction(unsigned int pPosition);
    113 
    114   bool activate(InputBuilder&) const;
    115 };
    116 
    117 /// NoAsNeededAction
    118 class NoAsNeededAction : public InputAction
    119 {
    120 public:
    121   explicit NoAsNeededAction(unsigned int pPosition);
    122 
    123   bool activate(InputBuilder&) const;
    124 };
    125 
    126 /// AddNeededAction
    127 class AddNeededAction : public InputAction
    128 {
    129 public:
    130   explicit AddNeededAction(unsigned int pPosition);
    131 
    132   bool activate(InputBuilder&) const;
    133 };
    134 
    135 /// NoAddNeededAction
    136 class NoAddNeededAction : public InputAction
    137 {
    138 public:
    139   explicit NoAddNeededAction(unsigned int pPosition);
    140 
    141   bool activate(InputBuilder&) const;
    142 };
    143 
    144 /// BDynamicAction
    145 class BDynamicAction : public InputAction
    146 {
    147 public:
    148   explicit BDynamicAction(unsigned int pPosition);
    149 
    150   bool activate(InputBuilder&) const;
    151 };
    152 
    153 /// BStaticAction
    154 class BStaticAction : public InputAction
    155 {
    156 public:
    157   explicit BStaticAction(unsigned int pPosition);
    158 
    159   bool activate(InputBuilder&) const;
    160 };
    161 
    162 } // end of namespace mcld
    163 
    164 #endif
    165 
    166