-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.

llvm-svn: 244112

llvm/include/llvm/DebugInfo/DIContext.h
llvm/include/llvm/ExecutionEngine/RuntimeDyld.h
llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCOFF.cpp
llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
llvm/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,