Class: LLVM::StructType
Instance Attribute Summary
Attributes inherited from Type
Attributes included from PointerIdentity
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
#===, #aggregate?, #align, array, double, #dump, #element_type, float, from_ptr, function, integer, label, #literal_struct?, named, #null, #null_pointer, opaque_struct, #opaque_struct?, #packed_struct?, #pointer, pointer, #poison, ptr, #size, struct, #to_s, #undef, vector, void, x86_amx, x86_mmx
Methods included from PointerIdentity
Instance Method Details
#element_types ⇒ Object
Returns the element types of the struct. : -> Array
380 381 382 383 384 385 386 387 388 |
# File 'lib/llvm/core/type.rb', line 380 def element_types count = C.count_struct_element_types(self) elt_types = [] #: Array[Type] 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) } end elt_types end |
#element_types=(elt_types) ⇒ Object
Sets the struct body. : ([untyped]) -> void
392 393 394 395 396 397 |
# File 'lib/llvm/core/type.rb', line 392 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. : -> String
374 375 376 |
# File 'lib/llvm/core/type.rb', line 374 def name C.get_struct_name(self) end |