[cfe-dev] struct copy

Argiris Kirtzidis akyrtzi at gmail.com
Sun Sep 28 11:59:08 PDT 2008


Chris Lattner wrote:
>
> Sure, that case is fine.  Try something like this:
>
> struct a {
>   char A;
>   double D;
> };
>
> union c {
>   struct a a;
>   int I;
> };
>
>
> Which compiles to:
>     %struct.a = type { i8, double }
>     %struct.c = type { %struct.a }
>
> Note that the llvm type for struct.c doesn't have members that fully 
> overlap "int I".

Ah ok, "unions as the biggest field" is bad. How about if we consider 
unions as arrays (as clang does):

    %struct.a = type { i8, double }
    %struct.c = type [12 x i8]




More information about the cfe-dev mailing list