[cfe-commits] r42473 - in /cfe/trunk: Parse/ParseObjc.cpp Sema/SemaDecl.cpp include/clang/AST/Decl.h

Chris Lattner clattner at apple.com
Sun Sep 30 00:54:49 PDT 2007


On Sep 29, 2007, at 11:24 AM, Fariborz Jahanian wrote:

> Author: fjahanian
> Date: Sat Sep 29 13:24:58 2007
> New Revision: 42473
>
> URL: http://llvm.org/viewvc/llvm-project?rev=42473&view=rev
> Log:
> This patch fixes all issues mentioned in clattner's feedback of
> September 28, 2007 4:39:24 PM PDT
> Please let me know if I missed anything.

Thanks Fariborz,

This isn't exactly what I meant, sorry for the confusion.  :(

Here you achieved the same space savings by moving the enum values up  
the class hierarchy into the Decl class.  However, you can use a nice  
feature of the itanium C++ ABI to get the same savings, without  
having to move the ivars up.  The feature is that classes like this:


class A {
   void *P;
   int X : 1;
   int Y : 2;
public:
...
}

class B : public A {
   int Z : 4;
   void *Q;
...
}

The bitfields in C will pack tightly with the bitfields in A, so this  
will end up taking 3 words of memory.  The problem with the previous  
version of the code was that it was defined as:

class C : public A {
   void *Q;
   int Z : 4;
...
}

Because the bitfield came after the pointer, the bitfields end up not  
packing together, requiring 4 words.  Can you please move the ivars  
back into the class they came from, but reorder them so that the  
bitfields come first in the subclass?

Thanks, sorry again for the confusion!

-Chris






More information about the cfe-commits mailing list