From 5a9bc50fa8c22e6e64bff68bc0733ee820defbe5 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 8 Aug 2009 20:50:49 +0000 Subject: [PATCH] stub out PECOFF/MachO/ELF MCSection classes llvm-svn: 78499 --- llvm/include/llvm/MC/MCSection.h | 28 +++++++++++++++++++++++++++- llvm/lib/MC/MCSection.cpp | 22 ++++++++++++++++++++-- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/llvm/include/llvm/MC/MCSection.h b/llvm/include/llvm/MC/MCSection.h index bdc46be11d5d..e73760a06646 100644 --- a/llvm/include/llvm/MC/MCSection.h +++ b/llvm/include/llvm/MC/MCSection.h @@ -53,7 +53,33 @@ namespace llvm { }; - typedef MCSection MCSectionELF; + class MCSectionELF : public MCSection { + MCSectionELF(const StringRef &Name, bool IsDirective, SectionKind K, + MCContext &Ctx) : MCSection(Name, IsDirective, K, Ctx) {} + public: + + static MCSectionELF *Create(const StringRef &Name, bool IsDirective, + SectionKind K, MCContext &Ctx); + + }; + + class MCSectionMachO : public MCSection { + MCSectionMachO(const StringRef &Name, bool IsDirective, SectionKind K, + MCContext &Ctx) : MCSection(Name, IsDirective, K, Ctx) {} + public: + + static MCSectionMachO *Create(const StringRef &Name, bool IsDirective, + SectionKind K, MCContext &Ctx); + }; + + class MCSectionPECOFF : public MCSection { + MCSectionPECOFF(const StringRef &Name, bool IsDirective, SectionKind K, + MCContext &Ctx) : MCSection(Name, IsDirective, K, Ctx) {} + public: + + static MCSectionPECOFF *Create(const StringRef &Name, bool IsDirective, + SectionKind K, MCContext &Ctx); + }; } // end namespace llvm diff --git a/llvm/lib/MC/MCSection.cpp b/llvm/lib/MC/MCSection.cpp index 84487b24be2e..2d5eb33b4d73 100644 --- a/llvm/lib/MC/MCSection.cpp +++ b/llvm/lib/MC/MCSection.cpp @@ -22,8 +22,26 @@ MCSection::MCSection(const StringRef &N, bool isDirective, SectionKind K, Entry = this; } -MCSection *MCSection::Create(const StringRef &Name, bool IsDirective, - SectionKind K, MCContext &Ctx) { +MCSection *MCSection:: +Create(const StringRef &Name, bool IsDirective, SectionKind K, MCContext &Ctx) { return new (Ctx) MCSection(Name, IsDirective, K, Ctx); } + +MCSectionELF *MCSectionELF:: +Create(const StringRef &Name, bool IsDirective, SectionKind K, MCContext &Ctx) { + return new (Ctx) MCSectionELF(Name, IsDirective, K, Ctx); +} + + +MCSectionMachO *MCSectionMachO:: +Create(const StringRef &Name, bool IsDirective, SectionKind K, MCContext &Ctx) { + return new (Ctx) MCSectionMachO(Name, IsDirective, K, Ctx); +} + + +MCSectionPECOFF *MCSectionPECOFF:: +Create(const StringRef &Name, bool IsDirective, SectionKind K, MCContext &Ctx) { + return new (Ctx) MCSectionPECOFF(Name, IsDirective, K, Ctx); +} +