From 36d045a51fbe1891f9739f79a0abaed6e7a76a55 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Mon, 19 Oct 2015 22:15:55 +0000 Subject: [PATCH] Fix -Wdeprecated regarding ORC copying ValueMaterializers 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 | 2 +- include/llvm/Transforms/Utils/ValueMapper.h | 9 +++++++-- lib/Linker/LinkModules.cpp | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h b/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h index 640ea04a416..bf649af5037 100644 --- a/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h +++ b/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h @@ -44,7 +44,7 @@ class CompileOnDemandLayer { private: template - class LambdaMaterializer : public ValueMaterializer { + class LambdaMaterializer final : public ValueMaterializer { public: LambdaMaterializer(MaterializerFtor M) : M(std::move(M)) {} Value* materializeValueFor(Value *V) final { diff --git a/include/llvm/Transforms/Utils/ValueMapper.h b/include/llvm/Transforms/Utils/ValueMapper.h index 1419618110c..6f4cd24c849 100644 --- a/include/llvm/Transforms/Utils/ValueMapper.h +++ b/include/llvm/Transforms/Utils/ValueMapper.h @@ -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. diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index 4d939a62f4b..27fdef46795 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -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 &LazilyLinkGlobalValues; -- 2.34.1