[cfe-commits] r96484 - in /cfe/trunk/lib: CodeGen/CGBlocks.cpp Sema/SemaDeclObjC.cpp

Fariborz Jahanian fjahanian at apple.com
Wed Feb 17 10:46:02 PST 2010


On Feb 17, 2010, at 10:33 AM, Douglas Gregor wrote:

> Comment below...
>
> Sent from my iPhone
>
> On Feb 17, 2010, at 10:11 AM, Fariborz Jahanian  
> <fjahanian at apple.com> wrote:
>
>> Author: fjahanian
>> Date: Wed Feb 17 12:10:54 2010
>> New Revision: 96484
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=96484&view=rev
>> Log:
>> Use proper lexcial context for newly added ivars.
>>
>>
>> Modified:
>>   cfe/trunk/lib/CodeGen/CGBlocks.cpp
>>   cfe/trunk/lib/Sema/SemaDeclObjC.cpp
>>
>> Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=96484&r1=96483&r2=96484&view=diff
>>
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Wed Feb 17 12:10:54 2010
>> @@ -110,6 +110,7 @@
>> /// invoke function.
>> static void AllocateAllBlockDeclRefs(const  
>> CodeGenFunction::BlockInfo &Info,
>>                                     CodeGenFunction *CGF) {
>> +#if 0
>>  // Always allocate self, as it is often handy in the debugger,  
>> even if there
>>  // is no codegen in the block that uses it.  This is also useful  
>> to always do
>>  // this as if we didn't, we'd have to figure out all code that  
>> uses a self
>> @@ -122,6 +123,7 @@
>>                       SelfDecl->getType(), SourceLocation(), false);
>>    CGF->AllocateBlockDecl(BDRE);
>>  }
>> +#endif
>>
>>  // FIXME: Also always forward the this pointer in C++ as well.
>>
>>
>> Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=96484&r1=96483&r2=96484&view=diff
>>
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Wed Feb 17 12:10:54 2010
>> @@ -825,8 +825,8 @@
>>    IDecl->setLocEnd(RBrace);
>>    // Add ivar's to class's DeclContext.
>>    for (unsigned i = 0, e = numIvars; i != e; ++i) {
>> -      ivars[i]->setLexicalDeclContext(IDecl);
>> -      IDecl->addDecl(ivars[i]);
>> +      ivars[i]->setLexicalDeclContext(ImpDecl);
>> +      IDecl->makeDeclVisibleInContext(ivars[i], false);
>
> Also,
>
>  ImpDecl->addDecl(ivars[i]);

>
>
> So that this ivar is stored in the @implementation.

I am not sure about this. This feature is to conform to what gcc does,  
which just adds ivar to its class.
Adding it to @implementation context messes up the lookup.

- Fariborz

>
>
>
>>    }
>>
>>    return;
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list