I'm building a StructType without a body using
StructType *StructType::create(LLVMContext &Context, StringRef Name);
and then later adding a body to with setBody(). It starts of isOpaque() == true, and isSized() == false, and after I add the body, isOpaque() == false, but isSized() is still false.
If I create a StructType using
StructType * StructType ::create(LLVMContext &Context,
ArrayRef<Type*> Elements,
StringRef Name,
bool isPacked = false);
Then isOpaque() == false and isSized() == true.
Can I not make a sized struct starting with an opaque one and adding a body later?
Hi Rick,
I'm building a StructType without a body using
StructType *StructType::create(LLVMContext &Context, StringRef Name);
and then later adding a body to with setBody(). It starts of isOpaque() == true, and isSized() == false, and after I add the body, isOpaque() == false, but isSized() is still false.
this is the standard way of making a struct type, so I suspect you made a
mistake such as adding an opaque field to the struct (this will stop it from
having a size).
Ciao, Duncan.
Thank you, Duncan. You're absolutely right. I thought I had confirmed the broken behavior with a simple test case, but that had a problem. I discovered in my actual struct that I was setting an element to be a function type, not a pointer-to-function type, just as you were writing your reply, I'd bet.
Thanks!