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