Use non virtual destructors for sections.

llvm-svn: 249548
This commit is contained in:
Rafael Espindola 2015-10-07 13:46:06 +00:00
parent bd3f2b9213
commit a975b17d63
6 changed files with 28 additions and 27 deletions

View File

@ -105,10 +105,9 @@ protected:
MCSection(SectionVariant V, SectionKind K, MCSymbol *Begin); MCSection(SectionVariant V, SectionKind K, MCSymbol *Begin);
SectionVariant Variant; SectionVariant Variant;
SectionKind Kind; SectionKind Kind;
~MCSection();
public: public:
virtual ~MCSection();
SectionKind getKind() const { return Kind; } SectionKind getKind() const { return Kind; }
SectionVariant getVariant() const { return Variant; } SectionVariant getVariant() const { return Variant; }

View File

@ -21,7 +21,7 @@ namespace llvm {
class MCSymbol; class MCSymbol;
/// This represents a section on Windows /// This represents a section on Windows
class MCSectionCOFF : public MCSection { class MCSectionCOFF final : public MCSection {
// The memory for this string is stored in the same MCContext as *this. // The memory for this string is stored in the same MCContext as *this.
StringRef SectionName; StringRef SectionName;
@ -51,9 +51,10 @@ private:
assert((Characteristics & 0x00F00000) == 0 && assert((Characteristics & 0x00F00000) == 0 &&
"alignment must not be set upon section creation"); "alignment must not be set upon section creation");
} }
~MCSectionCOFF() override;
public: public:
~MCSectionCOFF();
/// Decides whether a '.section' directive should be printed before the /// Decides whether a '.section' directive should be printed before the
/// section name /// section name
bool ShouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const; bool ShouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const;

View File

@ -27,7 +27,7 @@ class MCSymbol;
/// This represents a section on linux, lots of unix variants and some bare /// This represents a section on linux, lots of unix variants and some bare
/// metal systems. /// metal systems.
class MCSectionELF final : public MCSection { class MCSectionELF final : public MCSection {
/// This is the name of the section. The referenced memory is owned by /// This is the name of the section. The referenced memory is owned by
/// TargetLoweringObjectFileELF's ELFUniqueMap. /// TargetLoweringObjectFileELF's ELFUniqueMap.
StringRef SectionName; StringRef SectionName;
@ -61,11 +61,12 @@ private:
if (Group) if (Group)
Group->setIsSignature(); Group->setIsSignature();
} }
~MCSectionELF() override;
void setSectionName(StringRef Name) { SectionName = Name; } void setSectionName(StringRef Name) { SectionName = Name; }
public: public:
~MCSectionELF();
/// Decides whether a '.section' directive should be printed before the /// Decides whether a '.section' directive should be printed before the
/// section name /// section name
bool ShouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const; bool ShouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const;

View File

@ -22,7 +22,7 @@ namespace llvm {
/// This represents a section on a Mach-O system (used by Mac OS X). On a Mac /// This represents a section on a Mach-O system (used by Mac OS X). On a Mac
/// system, these are also described in /usr/include/mach-o/loader.h. /// system, these are also described in /usr/include/mach-o/loader.h.
class MCSectionMachO : public MCSection { class MCSectionMachO final : public MCSection {
char SegmentName[16]; // Not necessarily null terminated! char SegmentName[16]; // Not necessarily null terminated!
char SectionName[16]; // Not necessarily null terminated! char SectionName[16]; // Not necessarily null terminated!

View File

@ -4566,25 +4566,25 @@ void NVPTXTargetLowering::ReplaceNodeResults(
void NVPTXSection::anchor() {} void NVPTXSection::anchor() {}
NVPTXTargetObjectFile::~NVPTXTargetObjectFile() { NVPTXTargetObjectFile::~NVPTXTargetObjectFile() {
delete TextSection; delete static_cast<NVPTXSection*>(TextSection);
delete DataSection; delete static_cast<NVPTXSection*>(DataSection);
delete BSSSection; delete static_cast<NVPTXSection*>(BSSSection);
delete ReadOnlySection; delete static_cast<NVPTXSection*>(ReadOnlySection);
delete StaticCtorSection; delete static_cast<NVPTXSection*>(StaticCtorSection);
delete StaticDtorSection; delete static_cast<NVPTXSection*>(StaticDtorSection);
delete LSDASection; delete static_cast<NVPTXSection*>(LSDASection);
delete EHFrameSection; delete static_cast<NVPTXSection*>(EHFrameSection);
delete DwarfAbbrevSection; delete static_cast<NVPTXSection*>(DwarfAbbrevSection);
delete DwarfInfoSection; delete static_cast<NVPTXSection*>(DwarfInfoSection);
delete DwarfLineSection; delete static_cast<NVPTXSection*>(DwarfLineSection);
delete DwarfFrameSection; delete static_cast<NVPTXSection*>(DwarfFrameSection);
delete DwarfPubTypesSection; delete static_cast<NVPTXSection*>(DwarfPubTypesSection);
delete DwarfDebugInlineSection; delete static_cast<const NVPTXSection*>(DwarfDebugInlineSection);
delete DwarfStrSection; delete static_cast<NVPTXSection*>(DwarfStrSection);
delete DwarfLocSection; delete static_cast<NVPTXSection*>(DwarfLocSection);
delete DwarfARangesSection; delete static_cast<NVPTXSection*>(DwarfARangesSection);
delete DwarfRangesSection; delete static_cast<NVPTXSection*>(DwarfRangesSection);
} }
MCSection * MCSection *

View File

@ -22,11 +22,11 @@ namespace llvm {
/// Represents a section in PTX PTX does not have sections. We create this class /// Represents a section in PTX PTX does not have sections. We create this class
/// in order to use the ASMPrint interface. /// in order to use the ASMPrint interface.
/// ///
class NVPTXSection : public MCSection { class NVPTXSection final : public MCSection {
virtual void anchor(); virtual void anchor();
public: public:
NVPTXSection(SectionVariant V, SectionKind K) : MCSection(V, K, nullptr) {} NVPTXSection(SectionVariant V, SectionKind K) : MCSection(V, K, nullptr) {}
virtual ~NVPTXSection() {} ~NVPTXSection() {}
/// Override this as NVPTX has its own way of printing switching /// Override this as NVPTX has its own way of printing switching
/// to a section. /// to a section.