Class: LLVM::ConstantStruct

Inherits:
Constant show all
Defined in:
lib/llvm/core/value.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Constant

#bitcast_to, #gep, null, null_ptr, poison, #ptr_to_int, undef

Methods inherited from User

#operands

Methods inherited from Value

#add_attribute, #allocated_type, #allocated_type?, #constant?, #dump, from_ptr, from_ptr_kind, #gep_source_element_type, #gep_source_element_type?, #global_parent, #kind, #name, #name=, #null?, #poison?, #remove_attribute, to_ptr, #to_s, type, #type, #undef?

Methods included from PointerIdentity

#==, #eql?, #hash, #to_ptr

Class Method Details

.const(size_or_values, packed = false, &block) ⇒ Object

ConstantStruct.const(size) {|i| … } or ConstantStruct.const()



776
777
778
779
# File 'lib/llvm/core/value.rb', line 776

def self.const(size_or_values, packed = false, &block)
  vals = LLVM::Support.allocate_pointers(size_or_values, &block)
  from_ptr C.const_struct(vals, vals.size / vals.type_size, packed ? 1 : 0)
end

.named_const(type, size_or_values, &block) ⇒ Object



781
782
783
784
# File 'lib/llvm/core/value.rb', line 781

def self.named_const(type, size_or_values, &block)
  vals = LLVM::Support.allocate_pointers(size_or_values, &block)
  from_ptr C.const_named_struct(type, vals, vals.size / vals.type_size)
end

Instance Method Details

#[](idx) ⇒ Object



786
787
788
# File 'lib/llvm/core/value.rb', line 786

def [](idx)
  self.class.from_ptr(C.get_aggregate_element(self, idx))
end