[cfe-dev] __is_empty type trait patch
Anders Carlsson
andersca at mac.com
Mon Aug 3 08:21:16 PDT 2009
2 aug 2009 kl. 19.45 skrev Sean Hunt:
> Hello,
>
> I'm a new coder hoping to help out with the C++ implementation on
> clang.
> After fiddling around with several things I discovered were all being
> worked on already, someone recommended I implement the __is_empty type
> trait, so that is what I did. I was told to send a message here now;
> I've attached a patch.
Nice, welcome! :)
>
>
>
> + /// Empty - true when this class is empty for traits purposes,
> i.e. has no
> + /// data members other than 0-width bit-fields, has no virtual
> function/base,
> + /// and doesn't inherit from a non-empty class. Doesn't take
> union-ness into
> + /// account.
> + bool Empty : 1;
> +
You don't have to store this - the ASTRecordLayout already stores the
dataSize so you can just check to see if it's 0.
Anders
More information about the cfe-dev
mailing list