@@ -42,20 +42,19 @@ public extension IRType {
42
42
}
43
43
44
44
internal func convertType( _ type: LLVMTypeRef ) -> IRType {
45
+ let context = Context ( llvm: LLVMGetTypeContext ( type) )
45
46
switch LLVMGetTypeKind ( type) {
46
- case LLVMVoidTypeKind:
47
- return VoidType ( )
48
- case LLVMHalfTypeKind:
49
- return FloatType . half
50
- case LLVMFloatTypeKind: return FloatType . float
51
- case LLVMDoubleTypeKind: return FloatType . double
52
- case LLVMX86_FP80TypeKind: return FloatType . x86FP80
53
- case LLVMFP128TypeKind: return FloatType . fp128
54
- case LLVMPPC_FP128TypeKind: return FloatType . fp128
55
- case LLVMLabelTypeKind: return LabelType ( )
47
+ case LLVMVoidTypeKind: return VoidType ( in: context)
48
+ case LLVMFloatTypeKind: return FloatType ( kind: . float, in: context)
49
+ case LLVMHalfTypeKind: return FloatType ( kind: . half, in: context)
50
+ case LLVMDoubleTypeKind: return FloatType ( kind: . double, in: context)
51
+ case LLVMX86_FP80TypeKind: return FloatType ( kind: . x86FP80, in: context)
52
+ case LLVMFP128TypeKind: return FloatType ( kind: . fp128, in: context)
53
+ case LLVMPPC_FP128TypeKind: return FloatType ( kind: . fp128, in: context)
54
+ case LLVMLabelTypeKind: return LabelType ( in: context)
56
55
case LLVMIntegerTypeKind:
57
56
let width = LLVMGetIntTypeWidth ( type)
58
- return IntType ( width: Int ( width) )
57
+ return IntType ( width: Int ( width) , in : context )
59
58
case LLVMFunctionTypeKind:
60
59
var params = [ IRType] ( )
61
60
let count = Int ( LLVMCountParamTypes ( type) )
@@ -86,7 +85,7 @@ internal func convertType(_ type: LLVMTypeRef) -> IRType {
86
85
case LLVMMetadataTypeKind:
87
86
return MetadataType ( llvm: type)
88
87
case LLVMX86_MMXTypeKind:
89
- return X86MMXType ( )
88
+ return X86MMXType ( in : context )
90
89
case LLVMTokenTypeKind:
91
90
return TokenType ( llvm: type)
92
91
default : fatalError ( " unknown type kind for type \( type) " )
0 commit comments