Class: RLTK::CG::Context

Inherits:
Object show all
Includes:
BindingClass
Defined in:
lib/rltk/cg/context.rb

Overview

Bindings for LLVM contexts.

Instance Attribute Summary

Attributes included from BindingClass

#ptr

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BindingClass

#==

Constructor Details

#initialize(ptr = nil) ⇒ Context

Returns a new instance of Context.

Parameters:

  • ptr (FFI::Pointer, nil) (defaults to: nil)

    Pointer representing a context. If nil, a new context is created.



37
38
39
# File 'lib/rltk/cg/context.rb', line 37

def initialize(ptr = nil)
	@ptr = ptr || Bindings.context_create()
end

Class Method Details

.globalContext

Returns A global context.

Returns:



28
29
30
# File 'lib/rltk/cg/context.rb', line 28

def self.global
	self.new(Bindings.get_global_context())
end

Instance Method Details

#disposevoid

This method returns an undefined value.

Frees the resources used by LLVM for this context.



44
45
46
47
48
49
# File 'lib/rltk/cg/context.rb', line 44

def dispose
	if @ptr
		Bindings.context_dispose(@ptr)
		@ptr = nil
	end
end