[LLVMdev] Emitting recursive types

Christoph Grenz christophg+llvm at grenz-bonn.de
Sun Feb 17 14:03:56 PST 2013


Hi James,

Am Sonntag, 17. Februar 2013, 18:00:56 schrieb James Jackson:
> Hi,
> 
> I'm having a play with LLVM to implement a custom language (for my
> intellectual curiosity only). I'm wondering how, when using IRBuilder, one
> can can it to emit a recursive type definition? The code for TypeBuilder
> explicitly states that it doesn't handle recursive types...
> [...]

You have to create an opaque identified struct:
StructType *x = StructType::create(context, "name of your type");

And then set its body:
x->setBody(<Array which contains x>)

> Yours,
> James Jackson.

-- Christoph Grenz



More information about the llvm-dev mailing list