@@ -396,12 +396,11 @@ extension DIBuilder {
396396 type: DIType , alwaysPreserve: Bool = false ,
397397 flags: DIFlags = [ ] , alignment: Alignment
398398 ) -> LocalVariableMetadata {
399- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
400399 guard let variable = LLVMDIBuilderCreateAutoVariable (
401400 self . llvm, scope. asMetadata ( ) ,
402401 name, name. count, file. asMetadata ( ) , UInt32 ( line) ,
403402 type. asMetadata ( ) , alwaysPreserve. llvm,
404- flags. llvm, alignment. rawValue * radix )
403+ flags. llvm, alignment. valueInBits ( ) )
405404 else {
406405 fatalError ( " Failed to allocate metadata for a local variable " )
407406 }
@@ -512,13 +511,12 @@ extension DIBuilder {
512511 size: Size , alignment: Alignment ,
513512 elements: [ DIType ] , underlyingType: DIType
514513 ) -> DIType {
515- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
516514 var diTypes = elements. map { 0ドル. asMetadata ( ) as Optional }
517515 return diTypes. withUnsafeMutableBufferPointer { buf in
518516 guard let ty = LLVMDIBuilderCreateEnumerationType (
519517 self . llvm, scope. asMetadata ( ) ,
520518 name, name. count, file. asMetadata ( ) , UInt32 ( line) ,
521- size. valueInBits ( radix : UInt64 ( radix ) ) , alignment. rawValue * radix ,
519+ size. valueInBits ( ) , alignment. valueInBits ( ) ,
522520 buf. baseAddress!, UInt32 ( buf. count) ,
523521 underlyingType. asMetadata ( ) )
524522 else {
@@ -548,13 +546,12 @@ extension DIBuilder {
548546 elements: [ DIType ] ,
549547 runtimeVersion: Int = 0 , uniqueID: String = " "
550548 ) -> DIType {
551- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
552549 var diTypes = elements. map { 0ドル. asMetadata ( ) as Optional }
553550 return diTypes. withUnsafeMutableBufferPointer { buf in
554551 guard let ty = LLVMDIBuilderCreateUnionType (
555552 self . llvm, scope. asMetadata ( ) ,
556553 name, name. count, file. asMetadata ( ) , UInt32 ( line) ,
557- size. valueInBits ( radix : UInt64 ( radix ) ) , alignment. rawValue * radix ,
554+ size. valueInBits ( ) , alignment. valueInBits ( ) ,
558555 flags. llvm, buf. baseAddress!, UInt32 ( buf. count) ,
559556 UInt32 ( runtimeVersion) , uniqueID, uniqueID. count)
560557 else {
@@ -577,14 +574,13 @@ extension DIBuilder {
577574 size: Size , alignment: Alignment ,
578575 subscripts: [ Range < Int > ] = [ ]
579576 ) -> DIType {
580- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
581577 var diSubs = subscripts. map {
582578 LLVMDIBuilderGetOrCreateSubrange ( self . llvm,
583579 Int64 ( 0ドル. lowerBound) , Int64 ( 0ドル. count) )
584580 }
585581 return diSubs. withUnsafeMutableBufferPointer { buf in
586582 guard let ty = LLVMDIBuilderCreateArrayType (
587- self . llvm, size. rawValue, alignment. rawValue * radix ,
583+ self . llvm, size. rawValue, alignment. valueInBits ( ) ,
588584 elementType. asMetadata ( ) ,
589585 buf. baseAddress!, UInt32 ( buf. count) )
590586 else {
@@ -607,14 +603,13 @@ extension DIBuilder {
607603 size: Size , alignment: Alignment ,
608604 subscripts: [ Range < Int > ] = [ ]
609605 ) -> DIType {
610- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
611606 var diSubs = subscripts. map {
612607 LLVMDIBuilderGetOrCreateSubrange ( self . llvm,
613608 Int64 ( 0ドル. lowerBound) , Int64 ( 0ドル. count) )
614609 }
615610 return diSubs. withUnsafeMutableBufferPointer { buf in
616611 guard let ty = LLVMDIBuilderCreateVectorType (
617- self . llvm, size. rawValue, alignment. rawValue * radix ,
612+ self . llvm, size. rawValue, alignment. valueInBits ( ) ,
618613 elementType. asMetadata ( ) ,
619614 buf. baseAddress!, UInt32 ( buf. count) )
620615 else {
@@ -656,10 +651,9 @@ extension DIBuilder {
656651 public func buildBasicType(
657652 named name: String , encoding: DIAttributeTypeEncoding , flags: DIFlags , size: Size
658653 ) -> DIType {
659- let radix = UInt64 ( self . module. dataLayout. intPointerType ( ) . width)
660654 guard let ty = LLVMDIBuilderCreateBasicType (
661655 self . llvm, name, name. count,
662- size. valueInBits ( radix : radix ) , encoding. llvm, flags. llvm)
656+ size. valueInBits ( ) , encoding. llvm, flags. llvm)
663657 else {
664658 fatalError ( " Failed to allocate metadata " )
665659 }
@@ -678,10 +672,9 @@ extension DIBuilder {
678672 pointee: DIType , size: Size , alignment: Alignment ,
679673 addressSpace: AddressSpace = . zero, name: String = " "
680674 ) -> DIType {
681- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
682675 guard let ty = LLVMDIBuilderCreatePointerType (
683676 self . llvm, pointee. asMetadata ( ) ,
684- size. valueInBits ( radix : UInt64 ( radix ) ) , alignment. rawValue * radix ,
677+ size. valueInBits ( ) , alignment. valueInBits ( ) ,
685678 UInt32 ( addressSpace. rawValue) , name, name. count)
686679 else {
687680 fatalError ( " Failed to allocate metadata " )
@@ -710,13 +703,12 @@ extension DIBuilder {
710703 baseType: DIType ? = nil , elements: [ DIType ] = [ ] ,
711704 vtableHolder: DIType ? = nil , runtimeVersion: Int = 0 , uniqueID: String = " "
712705 ) -> DIType {
713- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
714706 var diEls = elements. map { 0ドル. asMetadata ( ) as Optional }
715707 return diEls. withUnsafeMutableBufferPointer { buf in
716708 guard let ty = LLVMDIBuilderCreateStructType (
717709 self . llvm, scope. asMetadata ( ) , name, name. count,
718710 file. asMetadata ( ) , UInt32 ( line) ,
719- size. valueInBits ( radix : UInt64 ( radix ) ) , alignment. rawValue * radix ,
711+ size. valueInBits ( ) , alignment. valueInBits ( ) ,
720712 flags. llvm,
721713 baseType? . asMetadata ( ) ,
722714 buf. baseAddress!, UInt32 ( buf. count) , UInt32 ( runtimeVersion) ,
@@ -745,11 +737,10 @@ extension DIBuilder {
745737 file: FileMetadata , line: Int ,
746738 size: Size , alignment: Alignment , offset: Size , flags: DIFlags = [ ]
747739 ) -> DIType {
748- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
749740 guard let ty = LLVMDIBuilderCreateMemberType (
750741 self . llvm, scope. asMetadata ( ) , name, name. count, file. asMetadata ( ) ,
751742 UInt32 ( line) ,
752- size. valueInBits ( radix : UInt64 ( radix ) ) , alignment. rawValue * radix ,
743+ size. valueInBits ( ) , alignment. valueInBits ( ) ,
753744 offset. rawValue,
754745 flags. llvm, parentType. asMetadata ( ) )
755746 else {
@@ -774,12 +765,11 @@ extension DIBuilder {
774765 line: Int , alignment: Alignment , flags: DIFlags = [ ] ,
775766 initialValue: IRConstant ? = nil
776767 ) -> DIType {
777- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
778768 guard let ty = LLVMDIBuilderCreateStaticMemberType (
779769 self . llvm, scope. asMetadata ( ) , name, name. count,
780770 file. asMetadata ( ) , UInt32 ( line) ,
781771 parentType. asMetadata ( ) , flags. llvm,
782- initialValue? . asLLVM ( ) , alignment. rawValue * radix )
772+ initialValue? . asLLVM ( ) , alignment. valueInBits ( ) )
783773 else {
784774 fatalError ( " Failed to allocate metadata " )
785775 }
@@ -799,10 +789,9 @@ extension DIBuilder {
799789 size: Size , alignment: Alignment ,
800790 flags: DIFlags = [ ]
801791 ) -> DIType {
802- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
803792 guard let ty = LLVMDIBuilderCreateMemberPointerType (
804793 self . llvm, pointee. asMetadata ( ) , baseType. asMetadata ( ) ,
805- size. valueInBits ( radix : UInt64 ( radix ) ) , alignment. rawValue * radix ,
794+ size. valueInBits ( ) , alignment. valueInBits ( ) ,
806795 flags. llvm)
807796 else {
808797 fatalError ( " Failed to allocate metadata " )
@@ -880,11 +869,10 @@ extension DIBuilder {
880869 file: FileMetadata ,
881870 line: Int
882871 ) -> DIType {
883- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
884872 guard let ty = LLVMDIBuilderCreateTypedef (
885873 self . llvm, type. asMetadata ( ) , name, name. count,
886874 file. asMetadata ( ) , UInt32 ( line) , scope. asMetadata ( ) ,
887- alignment. rawValue * radix )
875+ alignment. valueInBits ( ) )
888876 else {
889877 fatalError ( " Failed to allocate metadata " )
890878 }
@@ -904,12 +892,11 @@ extension DIBuilder {
904892 of derived: DIType , to base: DIType ,
905893 baseOffset: Size , virtualBasePointerOffset: Size , flags: DIFlags = [ ]
906894 ) -> DIType {
907- let radix = UInt64 ( self . module. dataLayout. intPointerType ( ) . width)
908895 guard let ty = LLVMDIBuilderCreateInheritance (
909896 self . llvm, derived. asMetadata ( ) ,
910897 base. asMetadata ( ) ,
911- baseOffset. valueInBits ( radix : radix ) ,
912- UInt32 ( virtualBasePointerOffset. valueInBits ( radix : radix ) ) ,
898+ baseOffset. valueInBits ( ) ,
899+ UInt32 ( virtualBasePointerOffset. valueInBits ( ) ) ,
913900 flags. llvm)
914901 else {
915902 fatalError ( " Failed to allocate metadata " )
@@ -936,12 +923,11 @@ extension DIBuilder {
936923 size: Size , alignment: Alignment ,
937924 runtimeLanguage: Int = 0 , uniqueID: String = " "
938925 ) -> DIType {
939- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
940926 guard let ty = LLVMDIBuilderCreateForwardDecl (
941927 self . llvm, tag. rawValue, name, name. count,
942928 scope. asMetadata ( ) , file. asMetadata ( ) , UInt32 ( line) ,
943929 UInt32 ( runtimeLanguage) ,
944- size. valueInBits ( radix : UInt64 ( radix ) ) , alignment. rawValue * radix ,
930+ size. valueInBits ( ) , alignment. valueInBits ( ) ,
945931 uniqueID, uniqueID. count) else {
946932 fatalError ( " Failed to allocate metadata " )
947933 }
@@ -968,12 +954,11 @@ extension DIBuilder {
968954 size: Size , alignment: Alignment , flags: DIFlags = [ ] ,
969955 runtimeVersion: Int = 0 , uniqueID: String = " "
970956 ) -> DIType {
971- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
972957 guard let ty = LLVMDIBuilderCreateReplaceableCompositeType (
973958 self . llvm, tag. rawValue, name, name. count,
974959 scope. asMetadata ( ) , file. asMetadata ( ) , UInt32 ( line) ,
975960 UInt32 ( runtimeVersion) ,
976- size. valueInBits ( radix : UInt64 ( radix ) ) , alignment. rawValue * radix ,
961+ size. valueInBits ( ) , alignment. valueInBits ( ) ,
977962 flags. llvm,
978963 uniqueID, uniqueID. count)
979964 else {
@@ -1000,12 +985,11 @@ extension DIBuilder {
1000985 size: Size , offset: Size , storageOffset: Size ,
1001986 flags: DIFlags = [ ]
1002987 ) -> DIType {
1003- let radix = UInt64 ( self . module. dataLayout. intPointerType ( ) . width)
1004988 guard let ty = LLVMDIBuilderCreateBitFieldMemberType (
1005989 self . llvm, scope. asMetadata ( ) , name, name. count,
1006990 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 ( ) ,
1009993 flags. llvm, type. asMetadata ( ) )
1010994 else {
1011995 fatalError ( " Failed to allocate metadata " )
@@ -1035,13 +1019,12 @@ extension DIBuilder {
10351019 elements: [ DIType ] = [ ] ,
10361020 vtableHolder: DIType ? = nil , uniqueID: String = " "
10371021 ) -> DIType {
1038- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
10391022 var diEls = elements. map { 0ドル. asMetadata ( ) as Optional }
10401023 return diEls. withUnsafeMutableBufferPointer { buf in
10411024 guard let ty = LLVMDIBuilderCreateClassType (
10421025 self . llvm, scope. asMetadata ( ) , name, name. count,
10431026 file. asMetadata ( ) , UInt32 ( line) ,
1044- size. valueInBits ( radix : UInt64 ( radix ) ) , alignment. rawValue * radix ,
1027+ size. valueInBits ( ) , alignment. valueInBits ( ) ,
10451028 offset. rawValue, flags. llvm,
10461029 baseType? . asMetadata ( ) ,
10471030 buf. baseAddress!, UInt32 ( buf. count) ,
@@ -1173,10 +1156,9 @@ extension DIBuilder {
11731156 file: FileMetadata , line: Int ,
11741157 size: Size , alignment: Alignment , offset: Size , flags: DIFlags = [ ]
11751158 ) -> DIType {
1176- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
11771159 guard let ty = LLVMDIBuilderCreateObjCIVar (
11781160 self . llvm, name, name. count, file. asMetadata ( ) , UInt32 ( line) ,
1179- size. valueInBits ( radix : UInt64 ( radix ) ) , alignment. rawValue * radix ,
1161+ size. valueInBits ( ) , alignment. valueInBits ( ) ,
11801162 offset. rawValue, flags. llvm, type. asMetadata ( ) , property. asMetadata ( ) )
11811163 else {
11821164 fatalError ( " Failed to allocate metadata " )
@@ -1268,15 +1250,14 @@ extension DIBuilder {
12681250 declaration: IRMetadata ? = nil ,
12691251 alignment: Alignment
12701252 ) -> ExpressionMetadata {
1271- let radix = UInt32 ( self . module. dataLayout. intPointerType ( ) . width)
12721253 guard let ty = LLVMDIBuilderCreateGlobalVariableExpression (
12731254 self . llvm, scope. asMetadata ( ) ,
12741255 name, name. count, linkageName, linkageName. count,
12751256 file. asMetadata ( ) , UInt32 ( line) ,
12761257 type. asMetadata ( ) ,
12771258 isLocal. llvm,
12781259 expression? . asMetadata ( ) , declaration? . asMetadata ( ) ,
1279- alignment. rawValue * radix )
1260+ alignment. valueInBits ( ) )
12801261 else {
12811262 fatalError ( " Failed to allocate metadata " )
12821263 }
0 commit comments