[cfe-dev] Patch for ContextDecl
Argiris Kirtzidis
akyrtzi at gmail.com
Sat Apr 5 18:05:31 PDT 2008
Hi,
The attached patch contains these changes:
-Renamed ContextDecl -> DeclContext
-Removed DeclContext pointer from FieldDecl
-EnumDecl inherits from DeclContext, instead of TagDecl
Chris Lattner wrote:
> Another next step: what do you think of hoisting
> FunctionDecl::DeclChain to be a member of ContextDecl? This would
> allow clients to iterate over all decls in a context, likewise for
> EnumDecl::ElementList etc?
The issue is that there's no convention on how the chain will be
traversed, FunctionDecl's members use getNext() and EnumDecl's members
use getNextDeclarator().
And both getNext() and getNextDeclarator() are not suitable for general
"decls in context iteration" since they have other uses.
For FunctionDecl, getNext() changes from "point to shadowed decl with
same id" to "point to next decl of function", but for other contexts
(like namespaces) it may be
required to stay "point to decl of same id".
If there's a need later on, a solution may be to add another dedicated
pointer in ScopedDecl to serve as a "point to next decl in context".
-Argiris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: declcontext.patch
Type: text/x-diff
Size: 32954 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080405/fd1d5578/attachment.patch>
More information about the cfe-dev
mailing list