<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Go binding leaks CreateGlobalVariable() function."
href="https://bugs.llvm.org/show_bug.cgi?id=46903">46903</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Go binding leaks CreateGlobalVariable() function.
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>10.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>DebugInfo
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mail@wud.me
</td>
</tr>
<tr>
<th>CC</th>
<td>jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
</td>
</tr></table>
<p>
<div>
<pre>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}
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>