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