File tree 3 files changed +19
-9
lines changed
3 files changed +19
-9
lines changed Original file line number Diff line number Diff line change @@ -78,11 +78,11 @@ internal func convertType(_ type: LLVMTypeRef) -> IRType {
78
78
let count = Int ( LLVMGetVectorSize ( type) )
79
79
return VectorType ( elementType: elementType, count: count)
80
80
case LLVMMetadataTypeKind:
81
- return MetadataType ( llvm : type )
81
+ return MetadataType ( in : context )
82
82
case LLVMX86_MMXTypeKind:
83
83
return X86MMXType ( in: context)
84
84
case LLVMTokenTypeKind:
85
- return TokenType ( llvm : type )
85
+ return TokenType ( in : context )
86
86
default : fatalError ( " unknown type kind for type \( type) " )
87
87
}
88
88
}
Original file line number Diff line number Diff line change @@ -5,15 +5,19 @@ import cllvm
5
5
/// The `MetadataType` type represents embedded metadata. No derived types may
6
6
/// be created from metadata except for function arguments.
7
7
public struct MetadataType : IRType {
8
- internal let llvm : LLVMTypeRef
8
+ /// Returns the context associated with this type.
9
+ public let context : Context
9
10
10
11
/// Creates an embedded metadata type for the given LLVM type object.
11
- public init ( llvm: LLVMTypeRef ) {
12
- self . llvm = llvm
12
+ ///
13
+ /// - parameter context: The context to create this type in
14
+ /// - SeeAlso: http://llvm.org/docs/ProgrammersManual.html#achieving-isolation-with-llvmcontext
15
+ public init ( in context: Context = Context . global) {
16
+ self . context = context
13
17
}
14
18
15
19
/// Retrieves the underlying LLVM type object.
16
20
public func asLLVM( ) -> LLVMTypeRef {
17
- return llvm
21
+ fatalError ( " This version of LLVM does not support the creation of MetadataType objects " )
18
22
}
19
23
}
Original file line number Diff line number Diff line change @@ -6,13 +6,19 @@ import cllvm
6
6
/// uses of the value must not attempt to introspect or obscure it. As such, it
7
7
/// is not appropriate to have a `PHI` or `select` of type `TokenType`.
8
8
public struct TokenType : IRType {
9
- internal let llvm : LLVMTypeRef
9
+ /// Returns the context associated with this type.
10
+ public let context : Context
10
11
11
12
/// Initializes a token type from the given LLVM type object.
12
- public init ( llvm: LLVMTypeRef ) { self . llvm = llvm }
13
+ ///
14
+ /// - parameter context: The context to create this type in
15
+ /// - SeeAlso: http://llvm.org/docs/ProgrammersManual.html#achieving-isolation-with-llvmcontext
16
+ public init ( in context: Context = Context . global) {
17
+ self . context = context
18
+ }
13
19
14
20
/// Retrieves the underlying LLVM type object.
15
21
public func asLLVM( ) -> LLVMTypeRef {
16
- return llvm
22
+ fatalError ( " This version of LLVM does not support the creation of TokenType objects " )
17
23
}
18
24
}
You can’t perform that action at this time.
0 commit comments