Class: LLVM::StructType
Instance Method Summary collapse
-
#element_types ⇒ Object
Returns the element types of the struct.
-
#element_types=(elt_types) ⇒ Object
Sets the struct body.
-
#name ⇒ Object
Returns the name of the struct.
Methods inherited from Type
#align, array, #dump, #element_type, from_ptr, function, #kind, #null, #null_pointer, #pointer, pointer, rec, #size, struct, #to_s, vector, void
Methods included from PointerIdentity
Instance Method Details
#element_types ⇒ Object
Returns the element types of the struct.
153 154 155 156 157 158 159 160 161 |
# File 'lib/llvm/core/type.rb', line 153 def element_types count = C.count_struct_element_types(self) elt_types = nil FFI::MemoryPointer.new(FFI.type_size(:pointer) * count) do |types_ptr| C.get_struct_element_types(self, types_ptr) elt_types = types_ptr.read_array_of_pointer(count).map { |type_ptr| Type.from_ptr(type_ptr, nil) } end elt_types end |
#element_types=(elt_types) ⇒ Object
Sets the struct body.
164 165 166 167 168 169 |
# File 'lib/llvm/core/type.rb', line 164 def element_types=(elt_types) elt_types.map! { |ty| LLVM::Type(ty) } elt_types_ptr = FFI::MemoryPointer.new(FFI.type_size(:pointer) * elt_types.size) elt_types_ptr.write_array_of_pointer(elt_types) C.struct_set_body(self, elt_types_ptr, elt_types.size, 0) end |
#name ⇒ Object
Returns the name of the struct.
148 149 150 |
# File 'lib/llvm/core/type.rb', line 148 def name C.get_struct_name(self) end |