[cfe-dev] [PATCH] Extend the use of DeclGroup
Douglas Gregor
dgregor at apple.com
Tue Jan 6 20:45:25 PST 2009
On Jan 6, 2009, at 7:14 PM, Zhongxing Xu wrote:
> On Wed, Jan 7, 2009 at 10:33 AM, Douglas Gregor <dgregor at apple.com>
> wrote:
> My hunch is that what we want is to find a way to iterate through a
> DeclContext in a way that allows us to see the DeclGroups (or, at
> least, see the syntactic relationship between "struct s { }" and
> "s_t"). However, I'd like to hear your thoughts on these ownership
> and representation issues.
>
> - Doug
>
> Hi Doug,
>
> I'll take a deep look at all the DeclContext stuff and mechanism in
> the following days. But my feeling is that DeclContext should be the
> ultimate solution to the ownership problem. I'll wait for your
> progress in this area.
I'll try to get this done sooner rather than later. There is
documentation on DeclContexts here:
http://clang.llvm.org/docs/InternalsManual.html#DeclContext
>
> On the other hand, as you said, we still need a mechanism to recover
> the original syntax structure of the source (and more ideally, the
> layout of the source code). I think the DeclGroup could play that
> role with the following structure:
> DeclGroup => TypeSpecifier Decls
>
> Instead of owning the decls, the DeclGroup and TypeSpecifier could
> only refer to the decls with a pointer.
Yes, I agree.
>
> Also the TopLevelDecls in TranslationUnit probably could be kept to
> reflect the code layout?
We shouldn't need it. A DeclContext's list of declarations (accessible
via decls_begin/decls_end) contains all of the declarations in the
order they occur within the source code, which is the same information
that TopLevelDecls tries to capture now.
- Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090106/f35e9e9c/attachment.html>
More information about the cfe-dev
mailing list