[cfe-dev] [PATCH] Ordinary name lookup for class and enum names in C++
Chris Lattner
clattner at apple.com
Sun Apr 13 13:48:19 PDT 2008
On Apr 13, 2008, at 10:12 AM, Doug Gregor wrote:
> On Sun, Apr 13, 2008 at 9:37 AM, Argiris Kirtzidis
> <akyrtzi at gmail.com> wrote:
>> How about modifying IdentifierResolver::AddDecl so that, when in C+
>> + and
>> decl is a RecordDecl, it looks for 'D' in normal namespace and in
>> the same
>> scope,
>> if a decl exists, it puts the RecordDecl on top of it in the chain:
>>
>> class D
>> ^- void D()
>>
>> That way non-tag decls get precedence when searching in both tag
>> and normal
>> namespaces.
>
> I went ahead with this approach.
Great!
> The attached patch allows searching
> in both the tag and ordinary namespaces in C++, so that we get the
> right name lookup for tag names without introducing implicit typedefs.
> Argiris, you might want to take a look at the IdentifierResolver bits.
Yes, Argiris please do review this.
> Interesting bits:
> - ASTContext::getTypeDeclType retrieves the QualType for any
> TypeDecl. This is the "gimmeTheType" operation that makes it look like
> we have the named-types-are-typedefs invariant, even though we don't..
Sounds good.
> Note that it builds RecordType and EnumType nodes for class types and
> enums, rather than TagType nodes. I've switched to using
> getTypeDeclType in those places in the front end where we can end up
> finding a named type; longer-term, I'd like to remove getTypedefType,
> getObjCInterfaceType, and getTagDeclType from ASTContext and have all
> clients call getTypeDeclType instead.
Sounds good. In the short term, it looks like all clients of
ASTContext::getTagDeclType can directly change to calling
getTypeDeclType now, want to remove it?
> The "-rel" version of the patch is relative against the "class" tag
> handling patch, here:
> http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-April/001411.html
Looks great to me, please apply!
-Chris
More information about the cfe-dev
mailing list