[cfe-dev] [Patch] IDNS_NoLookup?
Douglas Gregor
dgregor at apple.com
Tue Jan 20 08:11:17 PST 2009
On Jan 18, 2009, at 8:00 PM, Douglas Gregor wrote:
> 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.
For everyone who doesn't watch commits: we've gone slightly further
this with, removing ScopedDecl entirely and collapsing its fields into
Decl so that *every* declaration lives within a DeclContext. That way,
traversing through the various DeclContexts in a program will
(eventually) visit every declaration in the program.
Many *Decl nodes inherit from NamedDecl, meaning that they can have a
name and therefore can be found by name lookup. To address the problem
that Piotr found, we've taken some *Decl nodes that used to be
NamedDecls (ObjCImplementationDecl and LinkageSpecDecl, for example)
and made them inherit directly from Decl so that they don't ever have
names and can't ever be inserted for name lookup to find.
- Doug
More information about the cfe-dev
mailing list