Objects

class gccjit::object

Almost every entity in the API (with the exception of gccjit::context and gcc_jit_result*) is a “contextual” object, a gccjit::object.

A JIT object:

  • is associated with a gccjit::context.

  • is automatically cleaned up for you when its context is released so you don’t need to manually track and cleanup all objects, just the contexts.

The C++ class hierarchy within the gccjit namespace looks like this:

+- object
    +- location
    +- type
       +- struct
    +- field
    +- function
    +- block
    +- rvalue
        +- lvalue
           +- param
    +- case_

The gccjit::object base class has the following operations:

gccjit::context gccjit::object::get_context() const

Which context is the obj within?

std::string gccjit::object::get_debug_string() const

Generate a human-readable description for the given object.

For example,

printf ("obj: %s\n", obj.get_debug_string ().c_str ());

might give this text on stdout:

obj: 4.0 * (float)i