@@ -396,12 +396,11 @@ extension DIBuilder {
396
396
type: DIType , alwaysPreserve: Bool = false ,
397
397
flags: DIFlags = [ ] , alignment: Alignment
398
398
) -> LocalVariableMetadata {
399
- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
400
399
guard let variable = LLVMDIBuilderCreateAutoVariable (
401
400
self . llvm, scope. asMetadata ( ) ,
402
401
name, name. count, file. asMetadata ( ) , UInt32 ( line) ,
403
402
type. asMetadata ( ) , alwaysPreserve. llvm,
404
- flags. llvm, alignment. rawValue * radix )
403
+ flags. llvm, alignment. valueInBits )
405
404
else {
406
405
fatalError ( " Failed to allocate metadata for a local variable " )
407
406
}
@@ -512,13 +511,12 @@ extension DIBuilder {
512
511
size: Size , alignment: Alignment ,
513
512
elements: [ DIType ] , underlyingType: DIType
514
513
) -> DIType {
515
- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
516
514
var diTypes = elements. map { $0. asMetadata ( ) as Optional }
517
515
return diTypes. withUnsafeMutableBufferPointer { buf in
518
516
guard let ty = LLVMDIBuilderCreateEnumerationType (
519
517
self . llvm, scope. asMetadata ( ) ,
520
518
name, name. count, file. asMetadata ( ) , UInt32 ( line) ,
521
- size. valueInBits ( radix : UInt64 ( radix ) ) , alignment. rawValue * radix ,
519
+ size. valueInBits ( ) , alignment. valueInBits ,
522
520
buf. baseAddress!, UInt32 ( buf. count) ,
523
521
underlyingType. asMetadata ( ) )
524
522
else {
@@ -548,13 +546,12 @@ extension DIBuilder {
548
546
elements: [ DIType ] ,
549
547
runtimeVersion: Int = 0 , uniqueID: String = " "
550
548
) -> DIType {
551
- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
552
549
var diTypes = elements. map { $0. asMetadata ( ) as Optional }
553
550
return diTypes. withUnsafeMutableBufferPointer { buf in
554
551
guard let ty = LLVMDIBuilderCreateUnionType (
555
552
self . llvm, scope. asMetadata ( ) ,
556
553
name, name. count, file. asMetadata ( ) , UInt32 ( line) ,
557
- size. valueInBits ( radix : UInt64 ( radix ) ) , alignment. rawValue * radix ,
554
+ size. valueInBits ( ) , alignment. valueInBits ,
558
555
flags. llvm, buf. baseAddress!, UInt32 ( buf. count) ,
559
556
UInt32 ( runtimeVersion) , uniqueID, uniqueID. count)
560
557
else {
@@ -577,14 +574,13 @@ extension DIBuilder {
577
574
size: Size , alignment: Alignment ,
578
575
subscripts: [ Range < Int > ] = [ ]
579
576
) -> DIType {
580
- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
581
577
var diSubs = subscripts. map {
582
578
LLVMDIBuilderGetOrCreateSubrange ( self . llvm,
583
579
Int64 ( $0. lowerBound) , Int64 ( $0. count) )
584
580
}
585
581
return diSubs. withUnsafeMutableBufferPointer { buf in
586
582
guard let ty = LLVMDIBuilderCreateArrayType (
587
- self . llvm, size. rawValue, alignment. rawValue * radix ,
583
+ self . llvm, size. rawValue, alignment. valueInBits ,
588
584
elementType. asMetadata ( ) ,
589
585
buf. baseAddress!, UInt32 ( buf. count) )
590
586
else {
@@ -607,14 +603,13 @@ extension DIBuilder {
607
603
size: Size , alignment: Alignment ,
608
604
subscripts: [ Range < Int > ] = [ ]
609
605
) -> DIType {
610
- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
611
606
var diSubs = subscripts. map {
612
607
LLVMDIBuilderGetOrCreateSubrange ( self . llvm,
613
608
Int64 ( $0. lowerBound) , Int64 ( $0. count) )
614
609
}
615
610
return diSubs. withUnsafeMutableBufferPointer { buf in
616
611
guard let ty = LLVMDIBuilderCreateVectorType (
617
- self . llvm, size. rawValue, alignment. rawValue * radix ,
612
+ self . llvm, size. rawValue, alignment. valueInBits ,
618
613
elementType. asMetadata ( ) ,
619
614
buf. baseAddress!, UInt32 ( buf. count) )
620
615
else {
@@ -656,10 +651,9 @@ extension DIBuilder {
656
651
public func buildBasicType(
657
652
named name: String , encoding: DIAttributeTypeEncoding , flags: DIFlags , size: Size
658
653
) -> DIType {
659
- let radix = UInt64 ( self . module. dataLayout. intPointerType ( ) . width)
660
654
guard let ty = LLVMDIBuilderCreateBasicType (
661
655
self . llvm, name, name. count,
662
- size. valueInBits ( radix : radix ) , encoding. llvm, flags. llvm)
656
+ size. valueInBits ( ) , encoding. llvm, flags. llvm)
663
657
else {
664
658
fatalError ( " Failed to allocate metadata " )
665
659
}
@@ -678,10 +672,9 @@ extension DIBuilder {
678
672
pointee: DIType , size: Size , alignment: Alignment ,
679
673
addressSpace: AddressSpace = . zero, name: String = " "
680
674
) -> DIType {
681
- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
682
675
guard let ty = LLVMDIBuilderCreatePointerType (
683
676
self . llvm, pointee. asMetadata ( ) ,
684
- size. valueInBits ( radix : UInt64 ( radix ) ) , alignment. rawValue * radix ,
677
+ size. valueInBits ( ) , alignment. valueInBits ,
685
678
UInt32 ( addressSpace. rawValue) , name, name. count)
686
679
else {
687
680
fatalError ( " Failed to allocate metadata " )
@@ -710,13 +703,12 @@ extension DIBuilder {
710
703
baseType: DIType ? = nil , elements: [ DIType ] = [ ] ,
711
704
vtableHolder: DIType ? = nil , runtimeVersion: Int = 0 , uniqueID: String = " "
712
705
) -> DIType {
713
- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
714
706
var diEls = elements. map { $0. asMetadata ( ) as Optional }
715
707
return diEls. withUnsafeMutableBufferPointer { buf in
716
708
guard let ty = LLVMDIBuilderCreateStructType (
717
709
self . llvm, scope. asMetadata ( ) , name, name. count,
718
710
file. asMetadata ( ) , UInt32 ( line) ,
719
- size. valueInBits ( radix : UInt64 ( radix ) ) , alignment. rawValue * radix ,
711
+ size. valueInBits ( ) , alignment. valueInBits ,
720
712
flags. llvm,
721
713
baseType? . asMetadata ( ) ,
722
714
buf. baseAddress!, UInt32 ( buf. count) , UInt32 ( runtimeVersion) ,
@@ -745,11 +737,10 @@ extension DIBuilder {
745
737
file: FileMetadata , line: Int ,
746
738
size: Size , alignment: Alignment , offset: Size , flags: DIFlags = [ ]
747
739
) -> DIType {
748
- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
749
740
guard let ty = LLVMDIBuilderCreateMemberType (
750
741
self . llvm, scope. asMetadata ( ) , name, name. count, file. asMetadata ( ) ,
751
742
UInt32 ( line) ,
752
- size. valueInBits ( radix : UInt64 ( radix ) ) , alignment. rawValue * radix ,
743
+ size. valueInBits ( ) , alignment. valueInBits ,
753
744
offset. rawValue,
754
745
flags. llvm, parentType. asMetadata ( ) )
755
746
else {
@@ -774,12 +765,11 @@ extension DIBuilder {
774
765
line: Int , alignment: Alignment , flags: DIFlags = [ ] ,
775
766
initialValue: IRConstant ? = nil
776
767
) -> DIType {
777
- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
778
768
guard let ty = LLVMDIBuilderCreateStaticMemberType (
779
769
self . llvm, scope. asMetadata ( ) , name, name. count,
780
770
file. asMetadata ( ) , UInt32 ( line) ,
781
771
parentType. asMetadata ( ) , flags. llvm,
782
- initialValue? . asLLVM ( ) , alignment. rawValue * radix )
772
+ initialValue? . asLLVM ( ) , alignment. valueInBits )
783
773
else {
784
774
fatalError ( " Failed to allocate metadata " )
785
775
}
@@ -799,10 +789,9 @@ extension DIBuilder {
799
789
size: Size , alignment: Alignment ,
800
790
flags: DIFlags = [ ]
801
791
) -> DIType {
802
- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
803
792
guard let ty = LLVMDIBuilderCreateMemberPointerType (
804
793
self . llvm, pointee. asMetadata ( ) , baseType. asMetadata ( ) ,
805
- size. valueInBits ( radix : UInt64 ( radix ) ) , alignment. rawValue * radix ,
794
+ size. valueInBits ( ) , alignment. valueInBits ,
806
795
flags. llvm)
807
796
else {
808
797
fatalError ( " Failed to allocate metadata " )
@@ -880,11 +869,10 @@ extension DIBuilder {
880
869
file: FileMetadata ,
881
870
line: Int
882
871
) -> DIType {
883
- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
884
872
guard let ty = LLVMDIBuilderCreateTypedef (
885
873
self . llvm, type. asMetadata ( ) , name, name. count,
886
874
file. asMetadata ( ) , UInt32 ( line) , scope. asMetadata ( ) ,
887
- alignment. rawValue * radix )
875
+ alignment. valueInBits )
888
876
else {
889
877
fatalError ( " Failed to allocate metadata " )
890
878
}
@@ -904,12 +892,11 @@ extension DIBuilder {
904
892
of derived: DIType , to base: DIType ,
905
893
baseOffset: Size , virtualBasePointerOffset: Size , flags: DIFlags = [ ]
906
894
) -> DIType {
907
- let radix = UInt64 ( self . module. dataLayout. intPointerType ( ) . width)
908
895
guard let ty = LLVMDIBuilderCreateInheritance (
909
896
self . llvm, derived. asMetadata ( ) ,
910
897
base. asMetadata ( ) ,
911
- baseOffset. valueInBits ( radix : radix ) ,
912
- UInt32 ( virtualBasePointerOffset. valueInBits ( radix : radix ) ) ,
898
+ baseOffset. valueInBits ( ) ,
899
+ UInt32 ( virtualBasePointerOffset. valueInBits ( ) ) ,
913
900
flags. llvm)
914
901
else {
915
902
fatalError ( " Failed to allocate metadata " )
@@ -936,12 +923,11 @@ extension DIBuilder {
936
923
size: Size , alignment: Alignment ,
937
924
runtimeLanguage: Int = 0 , uniqueID: String = " "
938
925
) -> DIType {
939
- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
940
926
guard let ty = LLVMDIBuilderCreateForwardDecl (
941
927
self . llvm, tag. rawValue, name, name. count,
942
928
scope. asMetadata ( ) , file. asMetadata ( ) , UInt32 ( line) ,
943
929
UInt32 ( runtimeLanguage) ,
944
- size. valueInBits ( radix : UInt64 ( radix ) ) , alignment. rawValue * radix ,
930
+ size. valueInBits ( ) , alignment. valueInBits ,
945
931
uniqueID, uniqueID. count) else {
946
932
fatalError ( " Failed to allocate metadata " )
947
933
}
@@ -968,12 +954,11 @@ extension DIBuilder {
968
954
size: Size , alignment: Alignment , flags: DIFlags = [ ] ,
969
955
runtimeVersion: Int = 0 , uniqueID: String = " "
970
956
) -> DIType {
971
- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
972
957
guard let ty = LLVMDIBuilderCreateReplaceableCompositeType (
973
958
self . llvm, tag. rawValue, name, name. count,
974
959
scope. asMetadata ( ) , file. asMetadata ( ) , UInt32 ( line) ,
975
960
UInt32 ( runtimeVersion) ,
976
- size. valueInBits ( radix : UInt64 ( radix ) ) , alignment. rawValue * radix ,
961
+ size. valueInBits ( ) , alignment. valueInBits ,
977
962
flags. llvm,
978
963
uniqueID, uniqueID. count)
979
964
else {
@@ -1000,12 +985,11 @@ extension DIBuilder {
1000
985
size: Size , offset: Size , storageOffset: Size ,
1001
986
flags: DIFlags = [ ]
1002
987
) -> DIType {
1003
- let radix = UInt64 ( self . module. dataLayout. intPointerType ( ) . width)
1004
988
guard let ty = LLVMDIBuilderCreateBitFieldMemberType (
1005
989
self . llvm, scope. asMetadata ( ) , name, name. count,
1006
990
file. asMetadata ( ) , UInt32 ( line) ,
1007
- size. valueInBits ( radix : radix ) , offset. valueInBits ( radix : radix ) ,
1008
- storageOffset. valueInBits ( radix : radix ) ,
991
+ size. valueInBits ( ) , offset. valueInBits ( ) ,
992
+ storageOffset. valueInBits ( ) ,
1009
993
flags. llvm, type. asMetadata ( ) )
1010
994
else {
1011
995
fatalError ( " Failed to allocate metadata " )
@@ -1035,13 +1019,12 @@ extension DIBuilder {
1035
1019
elements: [ DIType ] = [ ] ,
1036
1020
vtableHolder: DIType ? = nil , uniqueID: String = " "
1037
1021
) -> DIType {
1038
- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
1039
1022
var diEls = elements. map { $0. asMetadata ( ) as Optional }
1040
1023
return diEls. withUnsafeMutableBufferPointer { buf in
1041
1024
guard let ty = LLVMDIBuilderCreateClassType (
1042
1025
self . llvm, scope. asMetadata ( ) , name, name. count,
1043
1026
file. asMetadata ( ) , UInt32 ( line) ,
1044
- size. valueInBits ( radix : UInt64 ( radix ) ) , alignment. rawValue * radix ,
1027
+ size. valueInBits ( ) , alignment. valueInBits ,
1045
1028
offset. rawValue, flags. llvm,
1046
1029
baseType? . asMetadata ( ) ,
1047
1030
buf. baseAddress!, UInt32 ( buf. count) ,
@@ -1173,10 +1156,9 @@ extension DIBuilder {
1173
1156
file: FileMetadata , line: Int ,
1174
1157
size: Size , alignment: Alignment , offset: Size , flags: DIFlags = [ ]
1175
1158
) -> DIType {
1176
- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
1177
1159
guard let ty = LLVMDIBuilderCreateObjCIVar (
1178
1160
self . llvm, name, name. count, file. asMetadata ( ) , UInt32 ( line) ,
1179
- size. valueInBits ( radix : UInt64 ( radix ) ) , alignment. rawValue * radix ,
1161
+ size. valueInBits ( ) , alignment. valueInBits ,
1180
1162
offset. rawValue, flags. llvm, type. asMetadata ( ) , property. asMetadata ( ) )
1181
1163
else {
1182
1164
fatalError ( " Failed to allocate metadata " )
@@ -1268,15 +1250,14 @@ extension DIBuilder {
1268
1250
declaration: IRMetadata ? = nil ,
1269
1251
alignment: Alignment
1270
1252
) -> ExpressionMetadata {
1271
- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
1272
1253
guard let ty = LLVMDIBuilderCreateGlobalVariableExpression (
1273
1254
self . llvm, scope. asMetadata ( ) ,
1274
1255
name, name. count, linkageName, linkageName. count,
1275
1256
file. asMetadata ( ) , UInt32 ( line) ,
1276
1257
type. asMetadata ( ) ,
1277
1258
isLocal. llvm,
1278
1259
expression? . asMetadata ( ) , declaration? . asMetadata ( ) ,
1279
- alignment. rawValue * radix )
1260
+ alignment. valueInBits )
1280
1261
else {
1281
1262
fatalError ( " Failed to allocate metadata " )
1282
1263
}
0 commit comments