[cfe-dev] Name lookup in ObjC methods
Chris Lattner
clattner at apple.com
Sun Mar 30 18:09:48 PDT 2008
On Mar 30, 2008, at 6:05 PM, Argiris Kirtzidis wrote:
> Chris Lattner wrote:
>> The second is more interesting for your namespace patch. I think
>> we really do need an AST-side concept of "scope", which is similar
>> to the parser one, but is also a bit different. This would allow
>> the implementation of ScopedDecl::isDefinedOutsideFunctionOrMethod
>> to correctly handle typedefs defined inside functions etc.
> Just a suggestion, how about a 'DeclContext' AST class that
> FunctionDecl would inherit from (and NamespaceDecl, RecordDecl):
>
> class FunctionDecl : public ValueDecl, public DeclContext {
> ....
>
> 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
More information about the cfe-dev
mailing list