I know that you ca use @code_lowered func()@code_typed func()@code_llvm func() or @code_native func() to get different represantations of this code. But is there a way to get an Expr? I need a macro/function that takes func() as an argument and returns:
quote
function func()
return 17
end
end
Note: putting an @mymacro in front of function func() is not an option, because it needs to work on existing code.
In julia, you can generate a function from the IR directly and still have a valid function. Any function generated in that way won’t have an Expr representation. Furthermore, CodeTracking.jl can only be so clever. Most functions generated by macros won’t be recognized or tracked by it.
That seems like a bug, but I don’t know. Perhaps open an issue on the github page.