Class: LLVM::ExecutionEngine::ModuleCollection
- Inherits:
-
Object
- Object
- LLVM::ExecutionEngine::ModuleCollection
- Defined in:
- lib/llvm/execution_engine.rb
Instance Method Summary collapse
- #add(mod) ⇒ ModuleCollection (also: #<<)
-
#delete(mod) ⇒ LLVM::Module
Deleted module.
-
#initialize(engine) ⇒ ModuleCollection
constructor
A new instance of ModuleCollection.
Constructor Details
#initialize(engine) ⇒ ModuleCollection
Returns a new instance of ModuleCollection.
107 108 109 |
# File 'lib/llvm/execution_engine.rb', line 107 def initialize(engine) @engine = engine end |
Instance Method Details
#add(mod) ⇒ ModuleCollection Also known as: <<
113 114 115 |
# File 'lib/llvm/execution_engine.rb', line 113 def add(mod) tap { C.add_module(@engine, mod) } end |
#delete(mod) ⇒ LLVM::Module
Returns deleted module.
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/llvm/execution_engine.rb', line 119 def delete(mod) error = FFI::MemoryPointer.new(:pointer) out_mod = FFI::MemoryPointer.new(:pointer) status = C.remove_module(@engine, mod, out_mod, error) if status.zero? LLVM::Module.from_ptr(out_mod.read_pointer) else errorp = error.read_pointer = errorp.read_string unless errorp.null? C.(error) error.autorelease = false raise "Error removing module: #{}" end end |