[llvm-bugs] [Bug 46903] New: Go binding leaks CreateGlobalVariable() function.
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jul 30 01:55:30 PDT 2020
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: unassignedbugs at nondot.org
Reporter: mail at wud.me
CC: jdevlieghere at apple.com, keith.walker at arm.com,
llvm-bugs at lists.llvm.org,
paul_robinson at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200730/484642dc/attachment.html>
More information about the llvm-bugs
mailing list