]> granicus.if.org Git - llvm/commitdiff
Remove the unnecessary virtual dtor from the DIEUnit hierarchy (in favor of protected...
authorDavid Blaikie <dblaikie@gmail.com>
Sat, 22 Apr 2017 02:18:00 +0000 (02:18 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Sat, 22 Apr 2017 02:18:00 +0000 (02:18 +0000)
These objects are never polymorphically owned/destroyed, so the virtual
dtor was unnecessary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301068 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/DIE.h
lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
lib/CodeGen/AsmPrinter/DwarfUnit.h
tools/dsymutil/DwarfLinker.cpp
unittests/DebugInfo/DWARF/DwarfGenerator.h

index 95c4b4248bbd0dcd091f67f5a44f4134953f103b..aa6a26fe1c3d5a86bb0e3bd932765a48bd475ef9 100644 (file)
@@ -793,6 +793,9 @@ class DIEUnit {
   uint32_t Length; /// The length in bytes of all of the DIEs in this unit.
   const uint16_t Version; /// The Dwarf version number for this unit.
   const uint8_t AddrSize; /// The size in bytes of an address for this unit.
+protected:
+  ~DIEUnit() = default;
+
 public:
   DIEUnit(uint16_t Version, uint8_t AddrSize, dwarf::Tag UnitTag);
   DIEUnit(const DIEUnit &RHS) = delete;
@@ -822,7 +825,11 @@ public:
   const DIE &getUnitDie() const { return Die; }
 };
 
-  
+struct BasicDIEUnit final : DIEUnit {
+  BasicDIEUnit(uint16_t Version, uint8_t AddrSize, dwarf::Tag UnitTag)
+      : DIEUnit(Version, AddrSize, UnitTag) {}
+};
+
 //===--------------------------------------------------------------------===//
 /// DIELoc - Represents an expression location.
 //
index 9a64b4b76b06ec4449e7e7e59b5c71affcd20827..20a415150b4d739bc72e8aeed1dde77803dc646a 100644 (file)
@@ -28,7 +28,7 @@ class DwarfFile;
 class MCSymbol;
 class LexicalScope;
 
-class DwarfCompileUnit : public DwarfUnit {
+class DwarfCompileUnit final : public DwarfUnit {
   /// A numeric ID unique among all CUs in the module
   unsigned UniqueID;
 
index d626ef920f956a9440a12bba0a2fc31487b83f51..d141acce812f48c4a3c0f5e367caf41e70bf632f 100644 (file)
@@ -104,8 +104,6 @@ protected:
   bool applySubprogramDefinitionAttributes(const DISubprogram *SP, DIE &SPDie);
 
 public:
-  virtual ~DwarfUnit();
-
   // Accessors.
   AsmPrinter* getAsmPrinter() const { return Asm; }
   uint16_t getLanguage() const { return CUNode->getSourceLanguage(); }
@@ -289,6 +287,8 @@ public:
   void constructTypeDIE(DIE &Buffer, const DICompositeType *CTy);
 
 protected:
+  ~DwarfUnit();
+
   /// Create new static data member DIE.
   DIE *getOrCreateStaticMemberDIE(const DIDerivedType *DT);
 
@@ -337,7 +337,7 @@ private:
   virtual bool isDwoUnit() const = 0;
 };
 
-class DwarfTypeUnit : public DwarfUnit {
+class DwarfTypeUnit final : public DwarfUnit {
   uint64_t TypeSignature;
   const DIE *Ty;
   DwarfCompileUnit &CU;
index 6ee052f101f93ffeda5292c98e495889dfbe628d..ce991290d6adaad2d94a916cef20d45939dad9ed 100644 (file)
@@ -223,7 +223,7 @@ public:
 
   DIE *getOutputUnitDIE() const {
     if (NewUnit)
-      return &const_cast<DIEUnit &>(*NewUnit).getUnitDie();
+      return &const_cast<BasicDIEUnit &>(*NewUnit).getUnitDie();
     return nullptr;
   }
 
@@ -333,7 +333,7 @@ private:
   DWARFUnit &OrigUnit;
   unsigned ID;
   std::vector<DIEInfo> Info; ///< DIE info indexed by DIE index.
-  Optional<DIEUnit> NewUnit;
+  Optional<BasicDIEUnit> NewUnit;
 
   uint64_t StartOffset;
   uint64_t NextUnitOffset;
index 966725b4fa4e77d271c20ca11a5bf1bd3e9a918a..76665e5193e83606b295ff97a10c1ad03828d5bd 100644 (file)
@@ -138,7 +138,7 @@ public:
 /// contained inside this class.
 class CompileUnit {
   Generator &DG;
-  DIEUnit DU;
+  BasicDIEUnit DU;
 
 public:
   CompileUnit(Generator &D, uint16_t V, uint8_t A)