r134829

Hi Vitaly,

I didn't add this API, because I'm not very familiar with the C API. It should be very straight-forward: just expose a wrapper for "StructType::setBody" and "StructType::createNamed".

Some motivation for the change is here:
http://nondot.org/sabre/LLVMNotes/TypeSystemRewrite.txt

-Chris

Hi Vitaly,

I didn't add this API, because I'm not very familiar with the C API. It should be very straight-forward: just expose a wrapper for "StructType::setBody" and "StructType::createNamed".

Some motivation for the change is here:
http://nondot.org/sabre/LLVMNotes/TypeSystemRewrite.txt

FYI, I should have a patch for this today or tomorrow. I am first trying it on the rust compiler, as soon as I get it bootstrapping I will post the patches.

-Chris

Cheers,
Rafael

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