Class: LLVM::ConstantArray

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

Class Method Summary collapse

Methods inherited from Constant

#bitcast_to, #gep, null, null_ptr, undef

Methods inherited from User

#operands

Methods inherited from Value

#==, #add_attribute, #constant?, #dump, #eql?, from_ptr, #hash, #name, #name=, #null?, to_ptr, #to_ptr, type, #type, #undefined?

Class Method Details

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

ConstantArray.const(type, 3) {|i| … } or ConstantArray.const(type, […])



280
281
282
283
# File 'lib/llvm/core/value.rb', line 280

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

.string(str, null_terminate = true) ⇒ Object



274
275
276
# File 'lib/llvm/core/value.rb', line 274

def self.string(str, null_terminate = true)
  from_ptr(C.LLVMConstString(str, str.length, null_terminate ? 0 : 1))
end