cgen: show the original malloc call on a detected leak

pull/9468/head
Delyan Angelov 2021-03-25 20:45:31 +02:00
parent 1bf7d968f9
commit f29ca6b8df
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 4 additions and 0 deletions

View File

@ -33,6 +33,10 @@ fn (mut g Gen) process_fn_decl(node ast.FnDecl) {
if !g.is_used_by_main(node) {
return
}
if g.is_builtin_mod && g.pref.gc_mode == .boehm_leak && node.name == 'malloc' {
g.definitions.write_string('#define v_malloc GC_MALLOC\n')
return
}
g.gen_attrs(node.attrs)
// g.tmp_count = 0 TODO
mut skip := false