Skip to content

Commit

Permalink
Fix -Wdeprecated regarding ORC copying ValueMaterializers
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dwblaikie committed Oct 19, 2015
1 parent 2949a6a commit 36d045a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 7 additions & 2 deletions include/llvm/Transforms/Utils/ValueMapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion lib/Linker/LinkModules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 36d045a

Please sign in to comment.