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
This commit is contained in:
Daniel Dunbar
2010-05-17 21:54:26 +00:00
parent db9014dd8b
commit 9a744e3860
6 changed files with 42 additions and 6 deletions

View File

@@ -44,7 +44,8 @@ namespace llvm {
unsigned Size;
PIC16Section(StringRef name, SectionKind K, StringRef addr, int color)
: MCSection(K), Name(name), Address(addr), Color(color), Size(0) {
: MCSection(SV_PIC16, K), Name(name), Address(addr),
Color(color), Size(0) {
}
public:
@@ -86,6 +87,11 @@ namespace llvm {
/// to a section.
virtual void PrintSwitchToSection(const MCAsmInfo &MAI,
raw_ostream &OS) const;
static bool classof(const MCSection *S) {
return S->getVariant() == SV_PIC16;
}
static bool classof(const PIC16Section *) { return true; }
};
} // end namespace llvm