Class: LLVM::ConstantArray
- Defined in:
- lib/llvm/core/value.rb
Class Method Summary collapse
-
.const(type, size_or_values, &block) ⇒ Object
ConstantArray.const(type, 3) {|i| … } or ConstantArray.const(type, […]).
- .string(str, null_terminate = true) ⇒ Object
Instance Method Summary collapse
Methods inherited from Constant
#bitcast_to, #gep, null, null_ptr, #ptr_to_int, undef
Methods inherited from User
Methods inherited from Value
#add_attribute, #allocated_type, #constant?, #dump, from_ptr, from_ptr_kind, #global_parent, #kind, #name, #name=, #null?, #remove_attribute, to_ptr, #to_s, type, #type, #undefined?
Methods included from PointerIdentity
Class Method Details
.const(type, size_or_values, &block) ⇒ Object
ConstantArray.const(type, 3) {|i| … } or ConstantArray.const(type, […])
344 345 346 347 |
# File 'lib/llvm/core/value.rb', line 344 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
338 339 340 |
# File 'lib/llvm/core/value.rb', line 338 def self.string(str, null_terminate = true) from_ptr(C.const_string(str, str.length, null_terminate ? 0 : 1)) end |
Instance Method Details
#[](idx) ⇒ Object
353 354 355 |
# File 'lib/llvm/core/value.rb', line 353 def [](idx) self.class.from_ptr(C.get_aggregate_element(self, idx)) end |
#size ⇒ Object
349 350 351 |
# File 'lib/llvm/core/value.rb', line 349 def size C.get_array_length(type) end |