1 //===- TargetFragment.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 10 #ifndef MCLD_LD_TARGET_FRAGMENT_H 11 #define MCLD_LD_TARGET_FRAGMENT_H 12 #ifdef ENABLE_UNITTEST 13 #include <gtest.h> 14 #endif 15 16 #include <mcld/LD/Fragment.h> 17 18 namespace mcld 19 { 20 21 class SectionData; 22 23 /** \class TargetFragment 24 * \brief TargetFragment is a kind of MCFragment inherited by 25 * target-depedent Fragment. 26 */ 27 class TargetFragment : public Fragment 28 { 29 protected: 30 TargetFragment(Fragment::Type pKind, SectionData* pSD = NULL) Fragment(pKind,pSD)31 : Fragment(pKind, pSD) {} 32 33 public: ~TargetFragment()34 virtual ~TargetFragment() {} 35 36 virtual size_t getSize() const = 0; 37 38 public: classof(const Fragment * F)39 static bool classof(const Fragment *F) 40 { return F->getKind() == Fragment::Target; } 41 classof(const TargetFragment *)42 static bool classof(const TargetFragment *) 43 { return true; } 44 }; 45 46 } // namespace of mcld 47 48 #endif 49 50