[cfe-commits] r65746 - in /cfe/trunk: lib/CodeGen/CGBlocks.cpp lib/CodeGen/CGExprConstant.cpp lib/CodeGen/CodeGenFunction.h test/CodeGen/blocks.c

Mike Stump mrs at apple.com
Sun Mar 1 11:12:21 PST 2009


On Mar 1, 2009, at 10:58 AM, Anders Carlsson wrote:
> 1 mar 2009 kl. 10.51 skrev Mike Stump:
>
>> On Feb 28, 2009, at 5:09 PM, Anders Carlsson wrote:
>>> +  // Check if the block can be global.
>>> +  if (CanBlockBeGlobal(Info))
>>> +    return CGM.GetAddrOfGlobalBlock(BE, Name.c_str());
>>
>> Like the last change, this also breaks things that were working.  :- 
>> (  Please, monotonic improvements only please.  We lazily create  
>> imports during codegen and your code doesn't account for that.
>
> I think it is better to just use one code path for creating global  
> blocks.

Why?  It replicates the other code entirely.

> I added code to look up imports beforehand.

And my point it, is is wrong.  It is slow, I don't want to walk around  
looking for all the data you walk around for and it is unnecessary and  
you broke previously working code like:

#include <stdio.h>

void foo(int i) {
     printf("%d\n", i);
}

int main() {
     __block int i; int j;
     j = 941;
     i = 942;
     &i;
     printf ("i is %d, j is %d\n", i, j);
     ^{^{ static int i; i = 943;     printf ("i is %d, j is %d\n", i,  
j); }();
         printf ("i is %d, j is %d\n", i, j); }();
     ^{ ^{ j; }(); }();
     printf ("i is %d, j is %d\n", i, j);
}



More information about the cfe-commits mailing list