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_COMMANDACTION_H_
     10 #define MCLD_MC_COMMANDACTION_H_
     11 
     12 #include "mcld/MC/InputAction.h"
     13 #include "mcld/Script/ScriptFile.h"
     14 #include "mcld/Support/Path.h"
     15 
     16 #include <string>
     17 
     18 namespace mcld {
     19 
     20 class SearchDirs;
     21 class InputBuilder;
     22 class LinkerConfig;
     23 
     24 //===----------------------------------------------------------------------===//
     25 // Derived InputAction
     26 //===----------------------------------------------------------------------===//
     27 /// InputFileAction
     28 class InputFileAction : public InputAction {
     29  public:
     30   InputFileAction(unsigned int pPosition, const sys::fs::Path& pPath);
     31 
     32   InputFileAction(unsigned int pPosition, const char* pPath);
     33 
     34   const sys::fs::Path& path() const { return m_Path; }
     35 
     36   bool activate(InputBuilder&) const;
     37 
     38  private:
     39   sys::fs::Path m_Path;
     40 };
     41 
     42 /// NamespecAction
     43 class NamespecAction : public InputAction {
     44  public:
     45   NamespecAction(unsigned int pPosition,
     46                  const std::string& pNamespec,
     47                  const 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   const SearchDirs& m_SearchDirs;
     56 };
     57 
     58 /// BitcodeAction
     59 class BitcodeAction : public InputAction {
     60  public:
     61   BitcodeAction(unsigned int pPosition, const sys::fs::Path& pPath);
     62 
     63   const sys::fs::Path& path() const { return m_Path; }
     64 
     65   bool activate(InputBuilder&) const;
     66 
     67  private:
     68   sys::fs::Path m_Path;
     69 };
     70 
     71 /// StartGroupAction
     72 class StartGroupAction : public InputAction {
     73  public:
     74   explicit StartGroupAction(unsigned int pPosition);
     75 
     76   bool activate(InputBuilder&) const;
     77 };
     78 
     79 /// EndGroupAction
     80 class EndGroupAction : public InputAction {
     81  public:
     82   explicit EndGroupAction(unsigned int pPosition);
     83 
     84   bool activate(InputBuilder&) const;
     85 };
     86 
     87 /// WholeArchiveAction
     88 class WholeArchiveAction : public InputAction {
     89  public:
     90   explicit WholeArchiveAction(unsigned int pPosition);
     91 
     92   bool activate(InputBuilder&) const;
     93 };
     94 
     95 /// NoWholeArchiveAction
     96 class NoWholeArchiveAction : public InputAction {
     97  public:
     98   explicit NoWholeArchiveAction(unsigned int pPosition);
     99 
    100   bool activate(InputBuilder&) const;
    101 };
    102 
    103 /// AsNeededAction
    104 class AsNeededAction : public InputAction {
    105  public:
    106   explicit AsNeededAction(unsigned int pPosition);
    107 
    108   bool activate(InputBuilder&) const;
    109 };
    110 
    111 /// NoAsNeededAction
    112 class NoAsNeededAction : public InputAction {
    113  public:
    114   explicit NoAsNeededAction(unsigned int pPosition);
    115 
    116   bool activate(InputBuilder&) const;
    117 };
    118 
    119 /// AddNeededAction
    120 class AddNeededAction : public InputAction {
    121  public:
    122   explicit AddNeededAction(unsigned int pPosition);
    123 
    124   bool activate(InputBuilder&) const;
    125 };
    126 
    127 /// NoAddNeededAction
    128 class NoAddNeededAction : public InputAction {
    129  public:
    130   explicit NoAddNeededAction(unsigned int pPosition);
    131 
    132   bool activate(InputBuilder&) const;
    133 };
    134 
    135 /// BDynamicAction
    136 class BDynamicAction : public InputAction {
    137  public:
    138   explicit BDynamicAction(unsigned int pPosition);
    139 
    140   bool activate(InputBuilder&) const;
    141 };
    142 
    143 /// BStaticAction
    144 class BStaticAction : public InputAction {
    145  public:
    146   explicit BStaticAction(unsigned int pPosition);
    147 
    148   bool activate(InputBuilder&) const;
    149 };
    150 
    151 /// DefSymAction
    152 class DefSymAction : public InputAction {
    153  public:
    154   explicit DefSymAction(unsigned int pPosition, const std::string& pAssignment);
    155 
    156   bool activate(InputBuilder&) const;
    157 
    158   const std::string& assignment() const { return m_Assignment; }
    159 
    160  private:
    161   const std::string& m_Assignment;
    162 };
    163 
    164 /// ScriptAction
    165 class ScriptAction : public InputAction {
    166  public:
    167   ScriptAction(unsigned int pPosition,
    168                const std::string& pFileName,
    169                ScriptFile::Kind pKind,
    170                const SearchDirs& pSearchDirs);
    171 
    172   bool activate(InputBuilder&) const;
    173 
    174   const std::string& filename() const { return m_FileName; }
    175 
    176   ScriptFile::Kind kind() const { return m_Kind; }
    177 
    178  private:
    179   std::string m_FileName;
    180   ScriptFile::Kind m_Kind;
    181   const SearchDirs& m_SearchDirs;
    182 };
    183 
    184 }  // namespace mcld
    185 
    186 #endif  // MCLD_MC_COMMANDACTION_H_
    187