OSDN Git Service

bindings/go: reinstate TargetMachine.TargetData
authorAndrew Wilkins <axwalk@gmail.com>
Tue, 15 Mar 2016 05:04:06 +0000 (05:04 +0000)
committerAndrew Wilkins <axwalk@gmail.com>
Tue, 15 Mar 2016 05:04:06 +0000 (05:04 +0000)
Summary:
LLVMGetTargetDataLayout was removed from the C API,
and then TargetMachine.TargetData was removed. Later,
LLVMCreateTargetMachineData was added to the C API,
and we now expose this via the Go API.

Reviewers: deadalnix, pcc

Subscribers: cierniak, llvm-commits, axw

Differential Revision: http://reviews.llvm.org/D18173

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263530 91177308-0d34-0410-b5e6-96231b3b80d8

bindings/go/llvm/target.go

index 5910b9b..268cc0e 100644 (file)
@@ -254,6 +254,13 @@ func (t Target) CreateTargetMachine(Triple string, CPU string, Features string,
        return
 }
 
+// CreateTargetData returns a new TargetData describing the TargetMachine's
+// data layout. The returned TargetData is owned by the caller, who is
+// responsible for disposing of it by calling the TargetData.Dispose method.
+func (tm TargetMachine) CreateTargetData() TargetData {
+       return TargetData{C.LLVMCreateTargetDataLayout(tm.C)}
+}
+
 // Triple returns the triple describing the machine (arch-vendor-os).
 func (tm TargetMachine) Triple() string {
        cstr := C.LLVMGetTargetMachineTriple(tm.C)