Index: llvm/trunk/bindings/go/llvm/ir.go =================================================================== --- llvm/trunk/bindings/go/llvm/ir.go +++ llvm/trunk/bindings/go/llvm/ir.go @@ -1258,6 +1258,19 @@ return } +// Operations on aggregates +func (v Value) Indices() []uint32 { + num := C.LLVMGetNumIndices(v.C) + indicesPtr := C.LLVMGetIndices(v.C) + // https://github.com/golang/go/wiki/cgo#turning-c-arrays-into-go-slices + rawIndices := (*[1 << 30]C.uint)(unsafe.Pointer(indicesPtr))[:num:num] + indices := make([]uint32, num) + for i := range indices { + indices[i] = uint32(rawIndices[i]) + } + return indices +} + //------------------------------------------------------------------------- // llvm.Builder //-------------------------------------------------------------------------