[LLVMdev] StructType opaque->sized

Duncan Sands baldrick at free.fr
Tue Jan 22 01:54:29 PST 2013


Hi Rick,

On 22/01/13 09:04, Rick Mann wrote:
> 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.

>
> 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?
>




More information about the llvm-dev mailing list