[cfe-dev] Name lookup in ObjC methods

Ted Kremenek kremenek at apple.com
Wed Apr 2 09:28:57 PDT 2008


On Apr 2, 2008, at 8:55 AM, Ted Kremenek wrote:

> All of this makes a lot of sense to me.  I like the unifying concept
> of context here, from the TranslationUnit level and down, and I like
> having NamespaceDecls having an enclosing context, etc., so that one
> can easily traverse the namespace hierarchy.  I'm curious, how would
> the following be handled:
>
>   namespace foo {
>     class F {  public:  void foo(); };
>   }
>
>   using namespace foo;
>
>   void F::foo() {}
>
> What would the "ContextDecl" be for the decl representing the
> definition of foo?  Would it be a NamespaceDecl, or a
> TranslationUnitDecl?  If it is a NamespaceDecl, is it the same
> NamespaceDecl as the one enclosing the class definition?  I'm sorry if
> this has already been discussed; I'm trying to wrap my mind around
> what exactly a ContextDecl is, as it seems to represents both a
> syntactic construct and a language concept.

I think I understand this better.  NamespaceDecl doesn't have a direct  
syntactic mapping, but represents a concept.  Also, the ContextDecl  
for the method definition of foo would be its ClassDecl, not the  
NamespaceDecl.



More information about the cfe-dev mailing list