diff --git a/src/core/instructions.jl b/src/core/instructions.jl index dfd8f04cb..fd6756f70 100644 --- a/src/core/instructions.jl +++ b/src/core/instructions.jl @@ -33,8 +33,7 @@ function Instruction(ref::API.LLVMValueRef) return T(ref) end -Instruction(inst::Instruction) = - Instruction(API.LLVMInstructionClone(inst)) +Base.copy(inst::Instruction) = Instruction(API.LLVMInstructionClone(inst)) unsafe_delete!(::BasicBlock, inst::Instruction) = API.LLVMInstructionEraseFromParent(inst) diff --git a/src/core/module.jl b/src/core/module.jl index a80a582c1..e936a400a 100644 --- a/src/core/module.jl +++ b/src/core/module.jl @@ -24,8 +24,7 @@ end Module(name::String) = mark_alloc(Module(API.LLVMModuleCreateWithNameInContext(name, context()))) -Module(mod::Module) = mark_alloc(Module(API.LLVMCloneModule(mod))) -Base.copy(mod::Module) = Module(mod) +Base.copy(mod::Module) = mark_alloc(Module(API.LLVMCloneModule(mod))) dispose(mod::Module) = mark_dispose(API.LLVMDisposeModule, mod) diff --git a/src/deprecated.jl b/src/deprecated.jl index 8c897f1ea..84632e322 100644 --- a/src/deprecated.jl +++ b/src/deprecated.jl @@ -25,3 +25,6 @@ Base.@deprecate_binding ValueMetadataDict LLVM.InstructionMetadataDict SyncScope(syncscope)), false) @deprecate Base.size(vectyp::VectorType) length(vectyp) false + +@deprecate Module(mod::Module) copy(mod) false +@deprecate Instruction(inst::Instruction) copy(inst) false