Home | History | Annotate | Download | only in Fragment
      1 //===- FillFragment.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_LD_FILLFRAGMENT_H
     10 #define MCLD_LD_FILLFRAGMENT_H
     11 #ifdef ENABLE_UNITTEST
     12 #include <gtest.h>
     13 #endif
     14 
     15 #include <llvm/Support/DataTypes.h>
     16 
     17 #include <mcld/Fragment/Fragment.h>
     18 
     19 namespace mcld {
     20 
     21 class SectionData;
     22 
     23 class FillFragment : public Fragment
     24 {
     25 public:
     26   FillFragment(int64_t pValue, unsigned int pValueSize, uint64_t pSize,
     27                SectionData* pSD = NULL);
     28 
     29   int64_t getValue() const { return m_Value; }
     30 
     31   unsigned getValueSize() const { return m_ValueSize; }
     32 
     33   static bool classof(const Fragment *F)
     34   { return F->getKind() == Fragment::Fillment; }
     35 
     36   static bool classof(const FillFragment *) { return true; }
     37 
     38   size_t size() const { return m_Size; }
     39 
     40 private:
     41   /// m_Value - Value used for filling bytes
     42   int64_t m_Value;
     43 
     44   /// m_ValueSize - The size (in bytes) of \arg Value to use when filling, or 0
     45   /// if this is a virtual fill fragment.
     46   unsigned int m_ValueSize;
     47 
     48   /// m_Size - The number of bytes to insert.
     49   uint64_t m_Size;
     50 };
     51 
     52 } // namespace of mcld
     53 
     54 #endif
     55 
     56