[cfe-commits] r66012 - in /cfe/trunk: lib/CodeGen/CGDecl.cpp test/CodeGen/bool-convert.c

Mike Stump mrs at apple.com
Wed Mar 4 07:10:57 PST 2009

On Mar 3, 2009, at 8:25 PM, Eli Friedman wrote:
> Continuation of PR3687: fix more places to use the right type for
> booleans.

[ waving hands ] I have a theory that says there is another way to  
structure this that doesn't rely upon random ConvertTypeForMem in hard  
to reason about places.  Something like an adaptor that hides all the  
intelligence and then the final use points have a certain shape that  
then just falls out more naturally.  As an example, I have 12  
ConvertType calls in CGBlocks.cpp, and I'd think that at least of few  
of them are wrong.  I can't help but wonder about objc bits having at  
least as many.

I came across this same issue in doing up __block support.  There,  
__block int is laid out something like:

   struct foo { void *; struct foo*forwarding; int; int; void*; void*;  
int x}

:-)  Oh the fun of it all.  I want to build up an accessor, most  
places would resolve down to something akin to -->forwarding->x, but a  
few very special places to just ->forwarding.  As it was, I littered  
the code to do the resolution in more than just 1 spot (bad).  I could  
reuse a nice general solution to this problem.   As I learn more, I'll  
keep an eye out for a solution.

More information about the cfe-commits mailing list