[cfe-dev] [Patch] IDNS_NoLookup?

Douglas Gregor dgregor at apple.com
Sun Jan 18 20:00:56 PST 2009


On Jan 18, 2009, at 5:58 PM, Chris Lattner wrote:

> On Jan 18, 2009, at 5:02 PM, Douglas Gregor wrote:
>> Ah, so that's the issue... the ObjCImplementationDecls need to have  
>> an
>> identifier namespace, because they have  name, but they aren't
>> supposed to be found by name lookup (rather, we see them through the
>> ObjCInterfaceDecl).
>
> Ah, very interesting.  I think the right fix is that  
> ObjCImplementationDecl should not be scope decls and maybe not even  
> NamedDecls.  They should never ever be "looked up".

I think we should swap ScopedDecl and NamedDecl in the inheritance  
hierarchy. Things without names---like, perhaps,  
ObjCImplementationDecl---should still be ScopedDecls and live inside  
DeclContexts (so we know where they occur, lexically, in the program,  
and who their owners are) but they don't need any storage for names.  
So, we would just have

   class NamedDecl : public ScopedDecl {
     DeclarationName Name;
   public:
     // ...
   };

Right now, the only ScopedDecl that isn't a NamedDecl is  
OverloadedFunctionDecl, and it's probably going away in favor of  
Argiris' idea for an OverloadedNameExpr. As Piotr had mentioned  
before, using directives are also never found by name lookup, but they  
do have scope, so they're natural ScopedDecls but not NamedDecls.

	- Doug



More information about the cfe-dev mailing list