@@ -384,49 +384,49 @@ func AttributeKindID(name string) (id uint) {
384384}
385385
386386func (c Context ) CreateEnumAttribute (kind uint , val uint64 ) (a Attribute ) {
387- a .C = C .LLVMCreateEnumAttribute (c .C , C .unsigned (kind ), C .uint64_t (val ))
388- return
387+ a .C = C .LLVMCreateEnumAttribute (c .C , C .unsigned (kind ), C .uint64_t (val ))
388+ return
389389}
390390
391391func (a Attribute ) GetEnumKind () (id int ) {
392- id = int (C .LLVMGetEnumAttributeKind (a .C ))
393- return
392+ id = int (C .LLVMGetEnumAttributeKind (a .C ))
393+ return
394394}
395395
396396func (a Attribute ) GetEnumValue () (val uint64 ) {
397- val = uint64 (C .LLVMGetEnumAttributeValue (a .C ))
398- return
397+ val = uint64 (C .LLVMGetEnumAttributeValue (a .C ))
398+ return
399399}
400400
401401func (c Context ) CreateStringAttribute (kind string , val string ) (a Attribute ) {
402- ckind := C .CString (kind )
403- defer C .free (unsafe .Pointer (ckind ))
404- cval := C .CString (val )
405- defer C .free (unsafe .Pointer (cval ))
406- a .C = C .LLVMCreateStringAttribute (c .C ,
407- ckind , C .unsigned (len (kind )),
408- cval , C .unsigned (len (val )))
409- return
402+ ckind := C .CString (kind )
403+ defer C .free (unsafe .Pointer (ckind ))
404+ cval := C .CString (val )
405+ defer C .free (unsafe .Pointer (cval ))
406+ a .C = C .LLVMCreateStringAttribute (c .C ,
407+ ckind , C .unsigned (len (kind )),
408+ cval , C .unsigned (len (val )))
409+ return
410410}
411411
412412func (a Attribute ) GetStringKind () string {
413- length := C .unsigned (0 )
414- ckind := C .LLVMGetStringAttributeKind (a .C , & length )
415- return C .GoStringN (ckind , C .int (length ))
413+ length := C .unsigned (0 )
414+ ckind := C .LLVMGetStringAttributeKind (a .C , & length )
415+ return C .GoStringN (ckind , C .int (length ))
416416}
417417
418418func (a Attribute ) GetStringValue () string {
419- length := C .unsigned (0 )
420- ckind := C .LLVMGetStringAttributeValue (a .C , & length )
421- return C .GoStringN (ckind , C .int (length ))
419+ length := C .unsigned (0 )
420+ ckind := C .LLVMGetStringAttributeValue (a .C , & length )
421+ return C .GoStringN (ckind , C .int (length ))
422422}
423423
424424func (a Attribute ) IsEnum () bool {
425- return C .LLVMIsEnumAttribute (a .C ) != 0 ;
425+ return C .LLVMIsEnumAttribute (a .C ) != 0
426426}
427427
428428func (a Attribute ) IsString () bool {
429- return C .LLVMIsStringAttribute (a .C ) != 0 ;
429+ return C .LLVMIsStringAttribute (a .C ) != 0
430430}
431431
432432//-------------------------------------------------------------------------
@@ -1150,36 +1150,36 @@ func (v Value) SetGC(name string) {
11501150 C .LLVMSetGC (v .C , cname )
11511151}
11521152func (v Value ) AddAttributeAtIndex (i int , a Attribute ) {
1153- C .LLVMAddAttributeAtIndex (v .C , C .LLVMAttributeIndex (i ), a .C )
1153+ C .LLVMAddAttributeAtIndex (v .C , C .LLVMAttributeIndex (i ), a .C )
11541154}
11551155func (v Value ) AddFunctionAttr (a Attribute ) {
1156- v .AddAttributeAtIndex (C .LLVMAttributeFunctionIndex , a );
1156+ v .AddAttributeAtIndex (C .LLVMAttributeFunctionIndex , a )
11571157}
11581158func (v Value ) GetEnumAttributeAtIndex (i int , kind uint ) (a Attribute ) {
1159- a .C = C .LLVMGetEnumAttributeAtIndex (v .C , C .LLVMAttributeIndex (i ), C .unsigned (kind ))
1160- return
1159+ a .C = C .LLVMGetEnumAttributeAtIndex (v .C , C .LLVMAttributeIndex (i ), C .unsigned (kind ))
1160+ return
11611161}
11621162func (v Value ) GetEnumFunctionAttribute (kind uint ) Attribute {
1163- return v .GetEnumAttributeAtIndex (C .LLVMAttributeFunctionIndex , kind )
1163+ return v .GetEnumAttributeAtIndex (C .LLVMAttributeFunctionIndex , kind )
11641164}
11651165func (v Value ) GetStringAttributeAtIndex (i int , kind string ) (a Attribute ) {
1166- ckind := C .CString (kind )
1167- defer C .free (unsafe .Pointer (ckind ))
1168- a .C = C .LLVMGetStringAttributeAtIndex (v .C , C .LLVMAttributeIndex (i ),
1169- ckind , C .unsigned (len (kind )))
1170- return
1166+ ckind := C .CString (kind )
1167+ defer C .free (unsafe .Pointer (ckind ))
1168+ a .C = C .LLVMGetStringAttributeAtIndex (v .C , C .LLVMAttributeIndex (i ),
1169+ ckind , C .unsigned (len (kind )))
1170+ return
11711171}
11721172func (v Value ) RemoveEnumAttributeAtIndex (i int , kind uint ) {
1173- C .LLVMRemoveEnumAttributeAtIndex (v .C , C .LLVMAttributeIndex (i ), C .unsigned (kind ))
1173+ C .LLVMRemoveEnumAttributeAtIndex (v .C , C .LLVMAttributeIndex (i ), C .unsigned (kind ))
11741174}
11751175func (v Value ) RemoveEnumFunctionAttribute (kind uint ) {
1176- v .RemoveEnumAttributeAtIndex (C .LLVMAttributeFunctionIndex , kind );
1176+ v .RemoveEnumAttributeAtIndex (C .LLVMAttributeFunctionIndex , kind )
11771177}
11781178func (v Value ) RemoveStringAttributeAtIndex (i int , kind string ) {
1179- ckind := C .CString (kind )
1180- defer C .free (unsafe .Pointer (ckind ))
1181- C .LLVMRemoveStringAttributeAtIndex (v .C , C .LLVMAttributeIndex (i ),
1182- ckind , C .unsigned (len (kind )))
1179+ ckind := C .CString (kind )
1180+ defer C .free (unsafe .Pointer (ckind ))
1181+ C .LLVMRemoveStringAttributeAtIndex (v .C , C .LLVMAttributeIndex (i ),
1182+ ckind , C .unsigned (len (kind )))
11831183}
11841184func (v Value ) AddTargetDependentFunctionAttr (attr , value string ) {
11851185 cattr := C .CString (attr )
@@ -1201,12 +1201,12 @@ func (v Value) Params() []Value {
12011201 }
12021202 return out
12031203}
1204- func (v Value ) Param (i int ) (rv Value ) { rv .C = C .LLVMGetParam (v .C , C .unsigned (i )); return }
1205- func (v Value ) ParamParent () (rv Value ) { rv .C = C .LLVMGetParamParent (v .C ); return }
1206- func (v Value ) FirstParam () (rv Value ) { rv .C = C .LLVMGetFirstParam (v .C ); return }
1207- func (v Value ) LastParam () (rv Value ) { rv .C = C .LLVMGetLastParam (v .C ); return }
1208- func NextParam (v Value ) (rv Value ) { rv .C = C .LLVMGetNextParam (v .C ); return }
1209- func PrevParam (v Value ) (rv Value ) { rv .C = C .LLVMGetPreviousParam (v .C ); return }
1204+ func (v Value ) Param (i int ) (rv Value ) { rv .C = C .LLVMGetParam (v .C , C .unsigned (i )); return }
1205+ func (v Value ) ParamParent () (rv Value ) { rv .C = C .LLVMGetParamParent (v .C ); return }
1206+ func (v Value ) FirstParam () (rv Value ) { rv .C = C .LLVMGetFirstParam (v .C ); return }
1207+ func (v Value ) LastParam () (rv Value ) { rv .C = C .LLVMGetLastParam (v .C ); return }
1208+ func NextParam (v Value ) (rv Value ) { rv .C = C .LLVMGetNextParam (v .C ); return }
1209+ func PrevParam (v Value ) (rv Value ) { rv .C = C .LLVMGetPreviousParam (v .C ); return }
12101210func (v Value ) SetParamAlignment (align int ) { C .LLVMSetParamAlignment (v .C , C .unsigned (align )) }
12111211
12121212// Operations on basic blocks
@@ -1351,10 +1351,11 @@ func (b Builder) Dispose() { C.LLVMDisposeBuilder(b.C) }
13511351
13521352// Metadata
13531353type DebugLoc struct {
1354- Line , Col uint
1355- Scope Metadata
1356- InlinedAt Metadata
1354+ Line , Col uint
1355+ Scope Metadata
1356+ InlinedAt Metadata
13571357}
1358+
13581359func (b Builder ) SetCurrentDebugLocation (line , col uint , scope , inlinedAt Metadata ) {
13591360 C .LLVMGoSetCurrentDebugLocation (b .C , C .unsigned (line ), C .unsigned (col ), scope .C , inlinedAt .C )
13601361}
0 commit comments