[cfe-dev] Name lookup in ObjC methods

Chris Lattner clattner at apple.com
Sun Mar 30 19:19:54 PDT 2008


>>> ScopedDecl would have a DeclContext member and  
>>> isDefinedOutsideFunctionOrMethod would check if it's a FunctionDecl.
>>
>> Yes, this is exactly what I was thinking (But ContextDecl instead  
>> of DeclContext :).
>>
>> With this change, we could then have a TranslationUnitDecl for the  
>> top-level.  It, ObjCMethod, and NamespaceDecl would also inherit  
>> from DeclContext.  What do you think?
>>
>> -Chris
> This sounds perfect. I'd like to give it a try tomorrow, if I may.

Wow, thanks!

> Should the ContextDecl member of ScopedDecl be a read-only property,  
> its value passed to the constructors of decls ? Or should there be a  
> setContextDecl method ?
> (The latter would be a bit more straightforward, if read-only is not  
> a requirement).

I don't have a strong opinion.  I think it does make sense to pass it  
into the ctor, but having a way to change it later could be useful.   
I'll leave it up to you.  Thanks Algiris.  Also, I apologize for not  
getting to your namespace patch sooner.

-Chris



More information about the cfe-dev mailing list