-Wdeprecated-clean: Fix cases of violating the rule of 5 in ways that are deprecated...
authorDavid Blaikie <dblaikie@gmail.com>
Wed, 5 Aug 2015 20:20:29 +0000 (20:20 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Wed, 5 Aug 2015 20:20:29 +0000 (20:20 +0000)
LoadedObjectInfo was depending on the implicit copy ctor in the presence
of a user-declared dtor. Default (and protect) it in the base class and
make the devired classes final to avoid any risk of a public API that
would enable slicing.

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

include/llvm/DebugInfo/DIContext.h
include/llvm/ExecutionEngine/RuntimeDyld.h
lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCOFF.cpp
lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp

index bdfd668..fa927d9 100644 (file)
@@ -140,6 +140,10 @@ private:
 /// to be used by the DIContext implementations when applying relocations
 /// on the fly.
 class LoadedObjectInfo {
+protected:
+  LoadedObjectInfo(const LoadedObjectInfo &) = default;
+  LoadedObjectInfo() = default;
+
 public:
   virtual ~LoadedObjectInfo() = default;
 
index 17c5fbd..7aaee15 100644 (file)
@@ -79,6 +79,11 @@ public:
   };
 
   template <typename Derived> struct LoadedObjectInfoHelper : LoadedObjectInfo {
+  protected:
+    LoadedObjectInfoHelper(const LoadedObjectInfoHelper &) = default;
+    LoadedObjectInfoHelper() = default;
+
+  public:
     LoadedObjectInfoHelper(RuntimeDyldImpl &RTDyld,
                            LoadedObjectInfo::ObjSectionToIDMap ObjSecToIDMap)
         : LoadedObjectInfo(RTDyld, std::move(ObjSecToIDMap)) {}
index e2979a6..338724d 100644 (file)
@@ -24,7 +24,7 @@ using namespace llvm::object;
 
 namespace {
 
-class LoadedCOFFObjectInfo
+class LoadedCOFFObjectInfo final
     : public RuntimeDyld::LoadedObjectInfoHelper<LoadedCOFFObjectInfo> {
 public:
   LoadedCOFFObjectInfo(RuntimeDyldImpl &RTDyld, ObjSectionToIDMap ObjSecToIDMap)
index dfa52fb..a93c3d3 100644 (file)
@@ -104,7 +104,7 @@ void DyldELFObject<ELFT>::updateSymbolAddress(const SymbolRef &SymRef,
   sym->st_value = static_cast<addr_type>(Addr);
 }
 
-class LoadedELFObjectInfo
+class LoadedELFObjectInfo final
     : public RuntimeDyld::LoadedObjectInfoHelper<LoadedELFObjectInfo> {
 public:
   LoadedELFObjectInfo(RuntimeDyldImpl &RTDyld, ObjSectionToIDMap ObjSecToIDMap)
index c9bd11a..7601ba2 100644 (file)
@@ -26,7 +26,7 @@ using namespace llvm::object;
 
 namespace {
 
-class LoadedMachOObjectInfo
+class LoadedMachOObjectInfo final
     : public RuntimeDyld::LoadedObjectInfoHelper<LoadedMachOObjectInfo> {
 public:
   LoadedMachOObjectInfo(RuntimeDyldImpl &RTDyld,