[LLVMdev] r134829
Jin Gu Kang
jaykang10 at imrc.kist.re.kr
Tue Jul 12 18:05:58 PDT 2011
> Hi Chris,
>
> What's a new way of building recursive types (with C bindings), once
> RefineType had been removed? And what's an exact reason for getting
> rid of the opaque types - I could not find a relevant discussion in a
> mailing list.
A simple example for recursive type may be as following.
/* C struct type */
struct foo {
struct foo *a;
};
/* Method */
StructType *STy = StructType::createNamed(Context, "struct.foo");
PointerType *PTy = STy->getPointerTo();
std::vector<Type*> Elements;
bool isPacked = false;
Elements.push_back((Type*)PTy);
STy->body(Elements, isPacked);
/* Result of llvm IR */
%struct.foo = type { %struct.foo* }
Thanks,
Jin-Gu Kang
More information about the llvm-dev
mailing list