https://bugs.llvm.org/show_bug.cgi?id=46903
Bug ID: 46903
Summary: Go binding leaks CreateGlobalVariable() function.
Product: libraries
Version: 10.0
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: DebugInfo
Assignee: unassignedb...@nondot.org
Reporter: m...@wud.me
CC: jdevliegh...@apple.com, keith.wal...@arm.com,
llvm-bugs@lists.llvm.org,
paul_robin...@playstation.sony.com
Go binding leaks CreateGlobalVariable().
And I have tried to write this manually, but I am wondering why don't go
binding implement this API?:
package llvm
/*
#include "IRBindings.h"
#include <stdlib.h>
*/
import "C"
import (
"unsafe"
)
type DIGlobalVariable struct {
Name string
Linkage string
File Metadata
Line int
Type Metadata
LocalToUnit bool
Expr Metadata
Decl Metadata
AlignInBits uint32
}
func (d *DIBuilder) CreateGlobalVariable(scope Metadata, v DIGlobalVariable)
Metadata {
name := C.CString(v.Name)
linkage := C.CString(v.Linkage)
defer C.free(unsafe.Pointer(name))
result := C.LLVMDIBuilderCreateGlobalVariableExpression(
d.ref,
scope.C,
name, C.size_t(len(v.Name)),
linkage, C.size_t(len(v.Linkage)),
v.File.C,
C.unsigned(v.Line),
v.Type.C,
C.LLVMBool(boolToCInt(v.LocalToUnit)),
v.Expr.C,
v.Decl.C,
C.uint32_t(v.AlignInBits))
return Metadata{C: result}
}
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs