diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-05-17 21:54:26 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-05-17 21:54:26 +0000 |
commit | 9a744e38607bc3046dffea56efec0b2dfc51d5e4 (patch) | |
tree | 4bf44a58963ea7ef65b4dea08df69fe73dff1ee1 /include/llvm/MC/MCSection.h | |
parent | db9014dd8b7b0b2581d10357b305f99f1b529316 (diff) | |
download | llvm-9a744e38607bc3046dffea56efec0b2dfc51d5e4.tar.gz llvm-9a744e38607bc3046dffea56efec0b2dfc51d5e4.tar.bz2 llvm-9a744e38607bc3046dffea56efec0b2dfc51d5e4.tar.xz |
MC: Add dyn_cast support to MCSection.
- Of questionable utility, since in general anything which wants to do this should probably be within a target specific hook, which can rely on the sections being of the appropriate type. However, it can be useful for short term hacks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103980 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/MC/MCSection.h')
-rw-r--r-- | include/llvm/MC/MCSection.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/include/llvm/MC/MCSection.h b/include/llvm/MC/MCSection.h index 1e2ef1e132..808767c8da 100644 --- a/include/llvm/MC/MCSection.h +++ b/include/llvm/MC/MCSection.h @@ -17,6 +17,7 @@ #include <string> #include "llvm/ADT/StringRef.h" #include "llvm/MC/SectionKind.h" +#include "llvm/Support/Casting.h" namespace llvm { class MCContext; @@ -27,15 +28,27 @@ namespace llvm { /// section in the current translation unit. The MCContext class uniques and /// creates these. class MCSection { + public: + enum SectionVariant { + SV_COFF = 0, + SV_ELF, + SV_MachO, + SV_PIC16 + }; + + private: MCSection(const MCSection&); // DO NOT IMPLEMENT void operator=(const MCSection&); // DO NOT IMPLEMENT protected: - MCSection(SectionKind K) : Kind(K) {} + MCSection(SectionVariant V, SectionKind K) : Variant(V), Kind(K) {} + SectionVariant Variant; SectionKind Kind; public: virtual ~MCSection(); SectionKind getKind() const { return Kind; } + + SectionVariant getVariant() const { return Variant; } virtual void PrintSwitchToSection(const MCAsmInfo &MAI, raw_ostream &OS) const = 0; @@ -47,6 +60,8 @@ namespace llvm { virtual bool isBaseAddressKnownZero() const { return false; } + + static bool classof(const MCSection *) { return true; } }; } // end namespace llvm |