[llvm] r363148 - [bindings/go][NFC] Format code with go fmt
Ayke van Laethem via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 12 04:59:09 PDT 2019
Author: aykevl
Date: Wed Jun 12 04:59:09 2019
New Revision: 363148
URL: http://llvm.org/viewvc/llvm-project?rev=363148&view=rev
Log:
[bindings/go][NFC] Format code with go fmt
Run go fmt (version 1.12) over the Go bindings. This cleans up lots of
inconsistencies in the code, it does not change the code in a functional
way.
Differential Revision: https://reviews.llvm.org/D63057
Modified:
llvm/trunk/bindings/go/llvm/dibuilder.go
llvm/trunk/bindings/go/llvm/ir.go
llvm/trunk/bindings/go/llvm/transforms_coroutines.go
Modified: llvm/trunk/bindings/go/llvm/dibuilder.go
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/go/llvm/dibuilder.go?rev=363148&r1=363147&r2=363148&view=diff
==============================================================================
--- llvm/trunk/bindings/go/llvm/dibuilder.go (original)
+++ llvm/trunk/bindings/go/llvm/dibuilder.go Wed Jun 12 04:59:09 2019
@@ -305,11 +305,11 @@ func (d *DIBuilder) CreateBasicType(t DI
// DIPointerType holds the values for creating pointer type debug metadata.
type DIPointerType struct {
- Pointee Metadata
- SizeInBits uint64
- AlignInBits uint32 // optional
+ Pointee Metadata
+ SizeInBits uint64
+ AlignInBits uint32 // optional
AddressSpace uint32
- Name string // optional
+ Name string // optional
}
// CreatePointerType creates a type that represents a pointer to another type.
@@ -355,14 +355,14 @@ func (d *DIBuilder) CreateSubroutineType
// DIStructType holds the values for creating struct type debug metadata.
type DIStructType struct {
- Name string
- File Metadata
- Line int
- SizeInBits uint64
- AlignInBits uint32
- Flags int
- DerivedFrom Metadata
- Elements []Metadata
+ Name string
+ File Metadata
+ Line int
+ SizeInBits uint64
+ AlignInBits uint32
+ Flags int
+ DerivedFrom Metadata
+ Elements []Metadata
VTableHolder Metadata // optional
UniqueID string
}
@@ -581,7 +581,7 @@ func (d *DIBuilder) InsertValueAtEnd(v V
}
func (v Value) SetSubprogram(sp Metadata) {
- C.LLVMSetSubprogram(v.C, sp.C)
+ C.LLVMSetSubprogram(v.C, sp.C)
}
func boolToCInt(v bool) C.int {
Modified: llvm/trunk/bindings/go/llvm/ir.go
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/go/llvm/ir.go?rev=363148&r1=363147&r2=363148&view=diff
==============================================================================
--- llvm/trunk/bindings/go/llvm/ir.go (original)
+++ llvm/trunk/bindings/go/llvm/ir.go Wed Jun 12 04:59:09 2019
@@ -384,49 +384,49 @@ func AttributeKindID(name string) (id ui
}
func (c Context) CreateEnumAttribute(kind uint, val uint64) (a Attribute) {
- a.C = C.LLVMCreateEnumAttribute(c.C, C.unsigned(kind), C.uint64_t(val))
- return
+ a.C = C.LLVMCreateEnumAttribute(c.C, C.unsigned(kind), C.uint64_t(val))
+ return
}
func (a Attribute) GetEnumKind() (id int) {
- id = int(C.LLVMGetEnumAttributeKind(a.C))
- return
+ id = int(C.LLVMGetEnumAttributeKind(a.C))
+ return
}
func (a Attribute) GetEnumValue() (val uint64) {
- val = uint64(C.LLVMGetEnumAttributeValue(a.C))
- return
+ val = uint64(C.LLVMGetEnumAttributeValue(a.C))
+ return
}
func (c Context) CreateStringAttribute(kind string, val string) (a Attribute) {
- ckind := C.CString(kind)
- defer C.free(unsafe.Pointer(ckind))
- cval := C.CString(val)
- defer C.free(unsafe.Pointer(cval))
- a.C = C.LLVMCreateStringAttribute(c.C,
- ckind, C.unsigned(len(kind)),
- cval, C.unsigned(len(val)))
- return
+ ckind := C.CString(kind)
+ defer C.free(unsafe.Pointer(ckind))
+ cval := C.CString(val)
+ defer C.free(unsafe.Pointer(cval))
+ a.C = C.LLVMCreateStringAttribute(c.C,
+ ckind, C.unsigned(len(kind)),
+ cval, C.unsigned(len(val)))
+ return
}
func (a Attribute) GetStringKind() string {
- length := C.unsigned(0)
- ckind := C.LLVMGetStringAttributeKind(a.C, &length)
- return C.GoStringN(ckind, C.int(length))
+ length := C.unsigned(0)
+ ckind := C.LLVMGetStringAttributeKind(a.C, &length)
+ return C.GoStringN(ckind, C.int(length))
}
func (a Attribute) GetStringValue() string {
- length := C.unsigned(0)
- ckind := C.LLVMGetStringAttributeValue(a.C, &length)
- return C.GoStringN(ckind, C.int(length))
+ length := C.unsigned(0)
+ ckind := C.LLVMGetStringAttributeValue(a.C, &length)
+ return C.GoStringN(ckind, C.int(length))
}
func (a Attribute) IsEnum() bool {
- return C.LLVMIsEnumAttribute(a.C) != 0;
+ return C.LLVMIsEnumAttribute(a.C) != 0
}
func (a Attribute) IsString() bool {
- return C.LLVMIsStringAttribute(a.C) != 0;
+ return C.LLVMIsStringAttribute(a.C) != 0
}
//-------------------------------------------------------------------------
@@ -1150,36 +1150,36 @@ func (v Value) SetGC(name string) {
C.LLVMSetGC(v.C, cname)
}
func (v Value) AddAttributeAtIndex(i int, a Attribute) {
- C.LLVMAddAttributeAtIndex(v.C, C.LLVMAttributeIndex(i), a.C)
+ C.LLVMAddAttributeAtIndex(v.C, C.LLVMAttributeIndex(i), a.C)
}
func (v Value) AddFunctionAttr(a Attribute) {
- v.AddAttributeAtIndex(C.LLVMAttributeFunctionIndex, a);
+ v.AddAttributeAtIndex(C.LLVMAttributeFunctionIndex, a)
}
func (v Value) GetEnumAttributeAtIndex(i int, kind uint) (a Attribute) {
- a.C = C.LLVMGetEnumAttributeAtIndex(v.C, C.LLVMAttributeIndex(i), C.unsigned(kind))
- return
+ a.C = C.LLVMGetEnumAttributeAtIndex(v.C, C.LLVMAttributeIndex(i), C.unsigned(kind))
+ return
}
func (v Value) GetEnumFunctionAttribute(kind uint) Attribute {
- return v.GetEnumAttributeAtIndex(C.LLVMAttributeFunctionIndex, kind)
+ return v.GetEnumAttributeAtIndex(C.LLVMAttributeFunctionIndex, kind)
}
func (v Value) GetStringAttributeAtIndex(i int, kind string) (a Attribute) {
- ckind := C.CString(kind)
- defer C.free(unsafe.Pointer(ckind))
- a.C = C.LLVMGetStringAttributeAtIndex(v.C, C.LLVMAttributeIndex(i),
- ckind, C.unsigned(len(kind)))
- return
+ ckind := C.CString(kind)
+ defer C.free(unsafe.Pointer(ckind))
+ a.C = C.LLVMGetStringAttributeAtIndex(v.C, C.LLVMAttributeIndex(i),
+ ckind, C.unsigned(len(kind)))
+ return
}
func (v Value) RemoveEnumAttributeAtIndex(i int, kind uint) {
- C.LLVMRemoveEnumAttributeAtIndex(v.C, C.LLVMAttributeIndex(i), C.unsigned(kind))
+ C.LLVMRemoveEnumAttributeAtIndex(v.C, C.LLVMAttributeIndex(i), C.unsigned(kind))
}
func (v Value) RemoveEnumFunctionAttribute(kind uint) {
- v.RemoveEnumAttributeAtIndex(C.LLVMAttributeFunctionIndex, kind);
+ v.RemoveEnumAttributeAtIndex(C.LLVMAttributeFunctionIndex, kind)
}
func (v Value) RemoveStringAttributeAtIndex(i int, kind string) {
- ckind := C.CString(kind)
- defer C.free(unsafe.Pointer(ckind))
- C.LLVMRemoveStringAttributeAtIndex(v.C, C.LLVMAttributeIndex(i),
- ckind, C.unsigned(len(kind)))
+ ckind := C.CString(kind)
+ defer C.free(unsafe.Pointer(ckind))
+ C.LLVMRemoveStringAttributeAtIndex(v.C, C.LLVMAttributeIndex(i),
+ ckind, C.unsigned(len(kind)))
}
func (v Value) AddTargetDependentFunctionAttr(attr, value string) {
cattr := C.CString(attr)
@@ -1201,12 +1201,12 @@ func (v Value) Params() []Value {
}
return out
}
-func (v Value) Param(i int) (rv Value) { rv.C = C.LLVMGetParam(v.C, C.unsigned(i)); return }
-func (v Value) ParamParent() (rv Value) { rv.C = C.LLVMGetParamParent(v.C); return }
-func (v Value) FirstParam() (rv Value) { rv.C = C.LLVMGetFirstParam(v.C); return }
-func (v Value) LastParam() (rv Value) { rv.C = C.LLVMGetLastParam(v.C); return }
-func NextParam(v Value) (rv Value) { rv.C = C.LLVMGetNextParam(v.C); return }
-func PrevParam(v Value) (rv Value) { rv.C = C.LLVMGetPreviousParam(v.C); return }
+func (v Value) Param(i int) (rv Value) { rv.C = C.LLVMGetParam(v.C, C.unsigned(i)); return }
+func (v Value) ParamParent() (rv Value) { rv.C = C.LLVMGetParamParent(v.C); return }
+func (v Value) FirstParam() (rv Value) { rv.C = C.LLVMGetFirstParam(v.C); return }
+func (v Value) LastParam() (rv Value) { rv.C = C.LLVMGetLastParam(v.C); return }
+func NextParam(v Value) (rv Value) { rv.C = C.LLVMGetNextParam(v.C); return }
+func PrevParam(v Value) (rv Value) { rv.C = C.LLVMGetPreviousParam(v.C); return }
func (v Value) SetParamAlignment(align int) { C.LLVMSetParamAlignment(v.C, C.unsigned(align)) }
// Operations on basic blocks
@@ -1351,10 +1351,11 @@ func (b Builder) Dispose() { C.LLVMDispo
// Metadata
type DebugLoc struct {
- Line, Col uint
- Scope Metadata
- InlinedAt Metadata
+ Line, Col uint
+ Scope Metadata
+ InlinedAt Metadata
}
+
func (b Builder) SetCurrentDebugLocation(line, col uint, scope, inlinedAt Metadata) {
C.LLVMGoSetCurrentDebugLocation(b.C, C.unsigned(line), C.unsigned(col), scope.C, inlinedAt.C)
}
Modified: llvm/trunk/bindings/go/llvm/transforms_coroutines.go
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/go/llvm/transforms_coroutines.go?rev=363148&r1=363147&r2=363148&view=diff
==============================================================================
--- llvm/trunk/bindings/go/llvm/transforms_coroutines.go (original)
+++ llvm/trunk/bindings/go/llvm/transforms_coroutines.go Wed Jun 12 04:59:09 2019
@@ -17,7 +17,7 @@ package llvm
*/
import "C"
-func (pm PassManager) AddCoroEarlyPass() { C.LLVMAddCoroEarlyPass(pm.C) }
-func (pm PassManager) AddCoroSplitPass() { C.LLVMAddCoroSplitPass(pm.C) }
-func (pm PassManager) AddCoroElidePass() { C.LLVMAddCoroElidePass(pm.C) }
-func (pm PassManager) AddCoroCleanupPass() { C.LLVMAddCoroCleanupPass(pm.C) }
+func (pm PassManager) AddCoroEarlyPass() { C.LLVMAddCoroEarlyPass(pm.C) }
+func (pm PassManager) AddCoroSplitPass() { C.LLVMAddCoroSplitPass(pm.C) }
+func (pm PassManager) AddCoroElidePass() { C.LLVMAddCoroElidePass(pm.C) }
+func (pm PassManager) AddCoroCleanupPass() { C.LLVMAddCoroCleanupPass(pm.C) }
More information about the llvm-commits
mailing list