[llvm] r249548 - Use non virtual destructors for sections.

Rafael Espíndola via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 7 13:35:15 PDT 2015


r249610, thanks.



On 7 October 2015 at 12:21, David Blaikie <dblaikie at gmail.com> wrote:

>
>
> On Wed, Oct 7, 2015 at 6:46 AM, Rafael Espindola via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Author: rafael
>> Date: Wed Oct  7 08:46:06 2015
>> New Revision: 249548
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=249548&view=rev
>> Log:
>> Use non virtual destructors for sections.
>>
>
> 👍
>
>
>>
>> Modified:
>>     llvm/trunk/include/llvm/MC/MCSection.h
>>     llvm/trunk/include/llvm/MC/MCSectionCOFF.h
>>     llvm/trunk/include/llvm/MC/MCSectionELF.h
>>     llvm/trunk/include/llvm/MC/MCSectionMachO.h
>>     llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp
>>     llvm/trunk/lib/Target/NVPTX/NVPTXSection.h
>>
>> Modified: llvm/trunk/include/llvm/MC/MCSection.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSection.h?rev=249548&r1=249547&r2=249548&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/MC/MCSection.h (original)
>> +++ llvm/trunk/include/llvm/MC/MCSection.h Wed Oct  7 08:46:06 2015
>> @@ -105,10 +105,9 @@ protected:
>>    MCSection(SectionVariant V, SectionKind K, MCSymbol *Begin);
>>    SectionVariant Variant;
>>    SectionKind Kind;
>> +  ~MCSection();
>>
>>  public:
>> -  virtual ~MCSection();
>> -
>>    SectionKind getKind() const { return Kind; }
>>
>>    SectionVariant getVariant() const { return Variant; }
>>
>> Modified: llvm/trunk/include/llvm/MC/MCSectionCOFF.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSectionCOFF.h?rev=249548&r1=249547&r2=249548&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/MC/MCSectionCOFF.h (original)
>> +++ llvm/trunk/include/llvm/MC/MCSectionCOFF.h Wed Oct  7 08:46:06 2015
>> @@ -21,7 +21,7 @@ namespace llvm {
>>  class MCSymbol;
>>
>>  /// 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.
>>    StringRef SectionName;
>>
>> @@ -51,9 +51,10 @@ private:
>>      assert((Characteristics & 0x00F00000) == 0 &&
>>             "alignment must not be set upon section creation");
>>    }
>> -  ~MCSectionCOFF() override;
>>
>>  public:
>> +  ~MCSectionCOFF();
>> +
>>    /// Decides whether a '.section' directive should be printed before the
>>    /// section name
>>    bool ShouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI)
>> const;
>>
>> Modified: llvm/trunk/include/llvm/MC/MCSectionELF.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSectionELF.h?rev=249548&r1=249547&r2=249548&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/MC/MCSectionELF.h (original)
>> +++ llvm/trunk/include/llvm/MC/MCSectionELF.h Wed Oct  7 08:46:06 2015
>> @@ -27,7 +27,7 @@ class MCSymbol;
>>
>>  /// This represents a section on linux, lots of unix variants and some
>> bare
>>  /// metal systems.
>> -class MCSectionELF final : public MCSection {
>> +class MCSectionELF final  : public MCSection {
>>
>
> Looks like some extra whitespace (two spaces between final and the :
> rather than one) snuck in here? Maybe clang-format the diff?
>
>
>>    /// This is the name of the section.  The referenced memory is owned by
>>    /// TargetLoweringObjectFileELF's ELFUniqueMap.
>>    StringRef SectionName;
>> @@ -61,11 +61,12 @@ private:
>>      if (Group)
>>        Group->setIsSignature();
>>    }
>> -  ~MCSectionELF() override;
>>
>>    void setSectionName(StringRef Name) { SectionName = Name; }
>>
>>  public:
>> +  ~MCSectionELF();
>> +
>>    /// Decides whether a '.section' directive should be printed before the
>>    /// section name
>>    bool ShouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI)
>> const;
>>
>> Modified: llvm/trunk/include/llvm/MC/MCSectionMachO.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSectionMachO.h?rev=249548&r1=249547&r2=249548&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/MC/MCSectionMachO.h (original)
>> +++ llvm/trunk/include/llvm/MC/MCSectionMachO.h Wed Oct  7 08:46:06 2015
>> @@ -22,7 +22,7 @@ namespace llvm {
>>
>>  /// 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.
>> -class MCSectionMachO : public MCSection {
>> +class MCSectionMachO final : public MCSection {
>>    char SegmentName[16];  // Not necessarily null terminated!
>>    char SectionName[16];  // Not necessarily null terminated!
>>
>>
>> Modified: llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp?rev=249548&r1=249547&r2=249548&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp (original)
>> +++ llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp Wed Oct  7 08:46:06
>> 2015
>> @@ -4566,25 +4566,25 @@ void NVPTXTargetLowering::ReplaceNodeRes
>>  void NVPTXSection::anchor() {}
>>
>>  NVPTXTargetObjectFile::~NVPTXTargetObjectFile() {
>> -  delete TextSection;
>> -  delete DataSection;
>> -  delete BSSSection;
>> -  delete ReadOnlySection;
>> +  delete static_cast<NVPTXSection*>(TextSection);
>> +  delete static_cast<NVPTXSection*>(DataSection);
>> +  delete static_cast<NVPTXSection*>(BSSSection);
>> +  delete static_cast<NVPTXSection*>(ReadOnlySection);
>>
>> -  delete StaticCtorSection;
>> -  delete StaticDtorSection;
>> -  delete LSDASection;
>> -  delete EHFrameSection;
>> -  delete DwarfAbbrevSection;
>> -  delete DwarfInfoSection;
>> -  delete DwarfLineSection;
>> -  delete DwarfFrameSection;
>> -  delete DwarfPubTypesSection;
>> -  delete DwarfDebugInlineSection;
>> -  delete DwarfStrSection;
>> -  delete DwarfLocSection;
>> -  delete DwarfARangesSection;
>> -  delete DwarfRangesSection;
>> +  delete static_cast<NVPTXSection*>(StaticCtorSection);
>> +  delete static_cast<NVPTXSection*>(StaticDtorSection);
>> +  delete static_cast<NVPTXSection*>(LSDASection);
>> +  delete static_cast<NVPTXSection*>(EHFrameSection);
>> +  delete static_cast<NVPTXSection*>(DwarfAbbrevSection);
>> +  delete static_cast<NVPTXSection*>(DwarfInfoSection);
>> +  delete static_cast<NVPTXSection*>(DwarfLineSection);
>> +  delete static_cast<NVPTXSection*>(DwarfFrameSection);
>> +  delete static_cast<NVPTXSection*>(DwarfPubTypesSection);
>> +  delete static_cast<const NVPTXSection*>(DwarfDebugInlineSection);
>> +  delete static_cast<NVPTXSection*>(DwarfStrSection);
>> +  delete static_cast<NVPTXSection*>(DwarfLocSection);
>> +  delete static_cast<NVPTXSection*>(DwarfARangesSection);
>> +  delete static_cast<NVPTXSection*>(DwarfRangesSection);
>>  }
>>
>>  MCSection *
>>
>> Modified: llvm/trunk/lib/Target/NVPTX/NVPTXSection.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXSection.h?rev=249548&r1=249547&r2=249548&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/Target/NVPTX/NVPTXSection.h (original)
>> +++ llvm/trunk/lib/Target/NVPTX/NVPTXSection.h Wed Oct  7 08:46:06 2015
>> @@ -22,11 +22,11 @@ namespace llvm {
>>  /// Represents a section in PTX PTX does not have sections. We create
>> this class
>>  /// in order to use the ASMPrint interface.
>>  ///
>> -class NVPTXSection : public MCSection {
>> +class NVPTXSection final : public MCSection {
>>    virtual void anchor();
>>  public:
>>    NVPTXSection(SectionVariant V, SectionKind K) : MCSection(V, K,
>> nullptr) {}
>> -  virtual ~NVPTXSection() {}
>> +  ~NVPTXSection() {}
>>
>>    /// Override this as NVPTX has its own way of printing switching
>>    /// to a section.
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151007/e2160c4b/attachment.html>


More information about the llvm-commits mailing list