Skip to content

Commit

Permalink
Forward kwargs when calling clone.
Browse files Browse the repository at this point in the history
This makes it possible to set a vmap, etc.
  • Loading branch information
maleadt committed Dec 12, 2024
1 parent 8490b8a commit 9bfc013
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ end
Simpler version of [`clone_into!`](@ref) that clones a function `f` into a new function,
optionally mapping values according to the `value_map` dictionary.
"""
function clone(f::Function; value_map::Dict{<:Value,<:Value}=Dict{Value,Value}())
function clone(f::Function; value_map::Dict{<:Value,<:Value}=Dict{Value,Value}(), kwargs...)
argtypes = LLVMType[]

# The user might be deleting arguments to the function by specifying them in
Expand Down Expand Up @@ -96,8 +96,7 @@ function clone(f::Function; value_map::Dict{<:Value,<:Value}=Dict{Value,Value}()
end
end

clone_into!(new_f, f;
value_map, changes=API.LLVMCloneFunctionChangeTypeLocalChangesOnly)
clone_into!(new_f, f; value_map, kwargs...)

return new_f
end
Expand Down

0 comments on commit 9bfc013

Please sign in to comment.