Fix -Wdeprecated regarding ORC copying ValueMaterializers
authorDavid Blaikie <dblaikie@gmail.com>
Mon, 19 Oct 2015 22:15:55 +0000 (22:15 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Mon, 19 Oct 2015 22:15:55 +0000 (22:15 +0000)
As usual, this is a polymorphic hierarchy without polymorphic ownership,
so simply make the dtor protected non-virtual, protected default copy
ctor/assign, and make derived classes final. The derived classes will
pick up correct default public copy ops (and dtor) implicitly.

(wish I could add -Wdeprecated to the build, but last time I tried it
triggered on some system headers I still need to look into/figure out)

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

include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
include/llvm/Transforms/Utils/ValueMapper.h
lib/Linker/LinkModules.cpp

index 640ea04a416be3f7806bc229a0f0ea2e834d7fb4..bf649af5037e3ad920f055f5c10e72fe714b07de 100644 (file)
@@ -44,7 +44,7 @@ class CompileOnDemandLayer {
 private:
 
   template <typename MaterializerFtor>
-  class LambdaMaterializer : public ValueMaterializer {
+  class LambdaMaterializer final : public ValueMaterializer {
   public:
     LambdaMaterializer(MaterializerFtor M) : M(std::move(M)) {}
     Value* materializeValueFor(Value *V) final {
index 1419618110c8b63d443342c757219a40386421f3..6f4cd24c849ffa2ae9600851fd038387bde74971 100644 (file)
@@ -38,9 +38,14 @@ namespace llvm {
   /// to materialize Values on demand.
   class ValueMaterializer {
     virtual void anchor(); // Out of line method.
-  public:
-    virtual ~ValueMaterializer() {}
 
+  protected:
+    ~ValueMaterializer() = default;
+    ValueMaterializer() = default;
+    ValueMaterializer(const ValueMaterializer&) = default;
+    ValueMaterializer &operator=(const ValueMaterializer&) = default;
+
+  public:
     /// materializeValueFor - The client should implement this method if they
     /// want to generate a mapped Value on demand. For example, if linking
     /// lazily.
index 4d939a62f4bb76fac4d530cb58834cf7de8aca7c..27fdef467959fc33fd06dd77e61663aea9e06f30 100644 (file)
@@ -365,7 +365,7 @@ class ModuleLinker;
 /// Creates prototypes for functions that are lazily linked on the fly. This
 /// speeds up linking for modules with many/ lazily linked functions of which
 /// few get used.
-class ValueMaterializerTy : public ValueMaterializer {
+class ValueMaterializerTy final : public ValueMaterializer {
   TypeMapTy &TypeMap;
   Module *DstM;
   std::vector<GlobalValue *> &LazilyLinkGlobalValues;