[cfe-dev] [PATCH]: C++ decl classes for the AST
Argiris Kirtzidis
akyrtzi at gmail.com
Fri May 16 15:47:00 PDT 2008
Hi,
The attached patch introduces new Decl subclasses that accomodate C++
class members (there are changes only to the AST library):
-'CXXRecordDecl' (inherits from RecordDecl) is for C++
struct/union/classes that are not simple C structs (i.e. they contain
methods, nested types etc.)
-'ClassMember' serves as a base class for members of a CXXRecord. It
provides the access specifier and the parent CXXRecord. Decls that
inherit ClassMember:
CXXField - for instance fields (inherits FieldDecl)
CXXMethod - for static and instance methods (inherits FunctionDecl)
NestedTypedef - for nested typedefs (inherits TypedefDecl)
NestedRecordDecl - for nested struct/union/classes (inherits
CXXRecordDecl)
ClassVar - for static data members (inherits VarDecl)
-I also moved the 'Decl' implementation to a separate 'DeclBase.cpp' file
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.
-Argiris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ast-cxxdecl.patch
Type: text/x-diff
Size: 55567 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080516/ae8653fe/attachment.patch>
More information about the cfe-dev
mailing list