Class: LLVM::Module::TypeCollection

Inherits:
Object
  • Object
show all
Defined in:
lib/llvm/core/module.rb

Instance Method Summary collapse

Constructor Details

#initialize(mod) ⇒ TypeCollection

Returns a new instance of TypeCollection.



46
47
48
# File 'lib/llvm/core/module.rb', line 46

def initialize(mod)
  @module = mod
end

Instance Method Details

#[](key) ⇒ Object

Returns the Type with the a name equal to key (symbol or string).



61
62
63
# File 'lib/llvm/core/module.rb', line 61

def [](key)
  named(key)
end

#[]=(key, type) ⇒ Object

Adds the given Type to the collection with a name equal to key (symbol or string).



66
67
68
# File 'lib/llvm/core/module.rb', line 66

def []=(key, type)
  add(key, type)
end

#add(name, type) ⇒ Object

Adds the given Type to the collection with the given name (symbol or string).



51
52
53
# File 'lib/llvm/core/module.rb', line 51

def add(name, type)
  C.LLVMAddTypeName(@module, name.to_s, type)
end

#named(name) ⇒ Object

Returns the Type with the given name (symbol or string).



56
57
58
# File 'lib/llvm/core/module.rb', line 56

def named(name)
  Type.from_ptr(C.LLVMGetTypeByName(@module, name.to_s))
end