[cfe-dev] [PATCH] Extend the use of DeclGroup

Douglas Gregor dgregor at apple.com
Mon Jan 12 10:28:10 PST 2009


On Jan 12, 2009, at 10:23 AM, Ted Kremenek wrote:
> How do we want to proceed with DeclGroups?  From my offline  
> conversations my understanding is that we plan on going ahead with  
> DeclGroups.

Yes. I think DeclContext needs to store DeclGroups (or, at least,  
provide a view so that the user sees DeclGroups), so that we'll get  
the benefits of DeclGroups everywhere we can store declarations.

	- Doug

> On Jan 6, 2009, at 10:09 PM, Zhongxing Xu wrote:
>
>>
>>
>> On Wed, Jan 7, 2009 at 12:45 PM, Douglas Gregor <dgregor at apple.com>  
>> wrote:
>> 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
>>
>> Thanks.
>>
>>
>>>
>>> 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.
>>
>> OK.
>>
>>
>> 	- Doug
>>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090112/fe7cbf8b/attachment.html>


More information about the cfe-dev mailing list