RegionFragment.h revision 87f34658dec9097d987d254a990ea7f311bfc95f
1//===- RegionFragment.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_FRAGMENT_REGIONFRAGMENT_H 10#define MCLD_FRAGMENT_REGIONFRAGMENT_H 11#ifdef ENABLE_UNITTEST 12#include <gtest.h> 13#endif 14 15#include <mcld/Fragment/Fragment.h> 16#include <llvm/ADT/StringRef.h> 17 18namespace mcld { 19 20/** \class RegionFragment 21 * \brief RegionFragment is a kind of Fragment containing input memory region 22 */ 23class RegionFragment : public Fragment 24{ 25public: 26 RegionFragment(llvm::StringRef pRegion, SectionData* pSD = NULL); 27 28 ~RegionFragment(); 29 30 const llvm::StringRef getRegion() const { return m_Region; } 31 llvm::StringRef getRegion() { return m_Region; } 32 33 static bool classof(const Fragment *F) 34 { return F->getKind() == Fragment::Region; } 35 36 static bool classof(const RegionFragment *) 37 { return true; } 38 39 size_t size() const; 40 41private: 42 llvm::StringRef m_Region; 43}; 44 45} // namespace of mcld 46 47#endif 48 49