[cfe-dev] [PATCH]: Preparing AST for C++ declarations

Argiris Kirtzidis akyrtzi at gmail.com
Wed Jun 4 12:39:50 PDT 2008

Eli Friedman wrote:
> [...]
>>> The instance fields of CXXRecord are stored in the members array of
>>> RecordDecl, thus the data layout of CXXRecord is calculated through the
>>> Record.
>>> All the other members (including the static fields), are ScopedDecls with
>>> the CXXRecord as declaration context, so they can be iterated through a
>>> general DeclContext member iterator (not implemented yet).
>>> Name lookup for class members will be efficient through the use of the
>>> IdentifierResolver.
>> The Nth member (as "getMember(N)") will be the Nth instance field of a
>> specific Record. It seems to me that it makes sense even when inheritance
>> comes into the picture, do you disagree ?
> The issue is the following: class B inherits from class A.  class A
> has a member x.  Is x accessible through getMember(N)?  If so, how do
> you figure out the ownership of a FieldDecl once it's in the
> RecordDecl?

The way I see it, getMember() will only return the instance fields of 
class B. When in C++, name lookup for members will be done through 
IdentifierResolver, not RecordDecl::getMember(IdentifierInfo *)


More information about the cfe-dev mailing list