Skip to content

Commit 2be779e

Browse files
authored
Deprecate copy ctors in favor of Base.copy. (#466)
1 parent 4335cb8 commit 2be779e

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/core/instructions.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ function Instruction(ref::API.LLVMValueRef)
3333
return T(ref)
3434
end
3535

36-
Instruction(inst::Instruction) =
37-
Instruction(API.LLVMInstructionClone(inst))
36+
Base.copy(inst::Instruction) = Instruction(API.LLVMInstructionClone(inst))
3837

3938
unsafe_delete!(::BasicBlock, inst::Instruction) =
4039
API.LLVMInstructionEraseFromParent(inst)

src/core/module.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ end
2424
Module(name::String) =
2525
mark_alloc(Module(API.LLVMModuleCreateWithNameInContext(name, context())))
2626

27-
Module(mod::Module) = mark_alloc(Module(API.LLVMCloneModule(mod)))
28-
Base.copy(mod::Module) = Module(mod)
27+
Base.copy(mod::Module) = mark_alloc(Module(API.LLVMCloneModule(mod)))
2928

3029
dispose(mod::Module) = mark_dispose(API.LLVMDisposeModule, mod)
3130

src/deprecated.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ Base.@deprecate_binding ValueMetadataDict LLVM.InstructionMetadataDict
2525
SyncScope(syncscope)), false)
2626

2727
@deprecate Base.size(vectyp::VectorType) length(vectyp) false
28+
29+
@deprecate Module(mod::Module) copy(mod) false
30+
@deprecate Instruction(inst::Instruction) copy(inst) false

0 commit comments

Comments
 (0)