[cfe-commits] r50538 - /cfe/trunk/lib/Sema/SemaDecl.cpp

Chris Lattner clattner at apple.com
Sun May 4 14:26:07 PDT 2008


On May 1, 2008, at 3:19 PM, Neil Booth wrote:

> Argiris Kirtzidis wrote:-
>
>> Author: akirtzidis
>> Date: Thu May  1 16:04:16 2008
>> New Revision: 50538
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=50538&view=rev
>> Log:
>> Implicitly defined functions were getting the DeclContext of the  
>> function where they appeared, causing the bug: http://llvm.org/bugs/show_bug.cgi?id=2266 
>> .
>> Fix it by making implicitly defined functions get the DeclContext  
>> of translation unit.
>
> Does this give them local or global scope?  They should only have  
> local
> scope; it sounds like you're making them global.

'context' is related but different than 'scope'.  I think Argiris' fix  
is the right one for this, but we still have the scope issue.

What do you suggest here Neil?  Right now we walk up the scope chain  
and insert the implicit definition at global scope, which prevents it  
from getting popped off the scope chain.  Is it best to mark it  
somehow as being locally defined or something, or is it best to remove  
it from the global scope chain when popped?

Alternatively, perhaps it shouldn't be added to global scope.  This  
would make diagnosing the undefined cases harder, but they could be  
handled with other hacks.

-Chris




More information about the cfe-commits mailing list