[cfe-commits] [Request for approval] Allow clang library applications to get specializations

Argyrios Kyrtzidis kyrtzidis at apple.com
Tue Jul 27 12:29:14 PDT 2010


On Jul 27, 2010, at 10:17 PM, Peter Collingbourne wrote:

> Argiris,
> 
> Agreed.  For consistency we can also have the FunctionTemplateDecl's
> specialisation iterator produce FunctionDecls instead of
> FunctionTemplateSpecializationInfos.

Yes, that'd be great.

> 
> I can work on a patch for this unless Abramo has an objection.
> I also have been working on a patch that refactors common code in the
> FunctionTemplateDecl and ClassTemplateDecl classes into a common base
> class (and provides an implementation of getLatestRedeclaration()
> for those two classes); I intend to build this work on top of the
> refactoring (I'll send out the patch soon).

Seems like a great plan!

-Argiris

> 
> Thanks,
> 
> On Tue, Jul 27, 2010 at 10:00:24PM +0300, Argyrios Kyrtzidis wrote:
>> Sounds good. I'd suggest that the iterator is a class wrapping the FoldingSet's iterator and making sure to return the latest redeclaration, what do you think ?
>> 
>> -Argiris
>> 
>> On Jul 27, 2010, at 9:55 PM, Peter Collingbourne wrote:
>> 
>>> Hi,
>>> 
>>> Another possibility would be to expose an iterator
>>> specs_begin()..specs_end() over the set of specialisations.  This way
>>> we don't need to copy the vector and the client still doesn't need
>>> to care how the specialisation list is stored.
>>> 
>>> (N.B. My application also needs to access the specialisation list.)
>>> 
>>> Thanks,
>>> 
>>> On Tue, Jul 27, 2010 at 08:25:26PM +0300, Argyrios Kyrtzidis wrote:
>>>> Hi Abramo,
>>>> 
>>>> How about adding a method to get the specializations in a vector, like the already existing:
>>>> 
>>>> /// \brief Retrieve the partial specializations as an ordered list.
>>>> void getPartialSpecializations(
>>>>         llvm::SmallVectorImpl<ClassTemplatePartialSpecializationDecl *> &PS);
>>>> 
>>>> 
>>>> Users of the template decls interface would not need to depend on how the specializations are stored.
>>>> For example, before I changed getSpecializations() to 'protected', the set contained the latest redeclarations but now the set contains just the canonical decls and we return the latest when the client makes a query about the specializations.
>>>> 
>>>> -Argiris
>>>> 
>>>> 
>>>> On Jul 27, 2010, at 12:41 PM, Abramo Bagnara wrote:
>>>> 
>>>>> The following patch restores the "public" access specifier for method
>>>>> getSpecializations() of FunctionTemplateDecl as well as methods
>>>>> getSpecializations() and getPartialSpecializations() of ClassTemplateDecl.
>>>>> 
>>>>> They were recently downgraded to "protected", but it seems that clients
>>>>> such as our application have no other way to query the set of all
>>>>> specializations of a given template.
>>>>> 
>>>>> <public-specializations.patch>_______________________________________________
>>>>> cfe-commits mailing list
>>>>> cfe-commits at cs.uiuc.edu
>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>>> 
>>> 
>>>> _______________________________________________
>>>> cfe-commits mailing list
>>>> cfe-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>> 
>>> 
>>> -- 
>>> Peter
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>> 
>> 
> 
> -- 
> Peter





More information about the cfe-commits mailing list