Class: LLVM::ConstantArray
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?
#==, #eql?, #hash, #to_ptr
Class Method Details
.const(type, size_or_values, &block) ⇒ Object
ConstantArray.const(type, 3) {|i| … } or ConstantArray.const(type, […])
380
381
382
383
|
# File 'lib/llvm/core/value.rb', line 380
def self.const(type, size_or_values, &block)
vals = LLVM::Support.allocate_pointers(size_or_values, &block)
from_ptr C.const_array(type, vals, vals.size / vals.type_size)
end
|
.string(str, null_terminate = true) ⇒ Object
370
371
372
|
# File 'lib/llvm/core/value.rb', line 370
def self.string(str, null_terminate = true)
from_ptr(C.const_string(str, str.length, null_terminate ? 0 : 1))
end
|
.string_in_context(context, str, null_terminate = true) ⇒ Object
374
375
376
|
# File 'lib/llvm/core/value.rb', line 374
def self.string_in_context(context, str, null_terminate = true)
from_ptr(C.const_string_in_context2(context, str, str.length, null_terminate ? 0 : 1))
end
|
Instance Method Details
#[](idx) ⇒ Object
389
390
391
|
# File 'lib/llvm/core/value.rb', line 389
def [](idx)
self.class.from_ptr(C.get_aggregate_element(self, idx))
end
|
#size ⇒ Object
385
386
387
|
# File 'lib/llvm/core/value.rb', line 385
def size
C.get_array_length(type)
end
|