[cfe-dev] Template parameters of friend declarations.
Enea Zaffanella
zaffanella at cs.unipr.it
Fri Jan 25 09:44:02 PST 2013
On 01/23/2013 01:46 PM, Enea Zaffanella wrote:
> On 01/23/2013 12:16 AM, John McCall wrote:
>> On Jan 22, 2013, at 3:07 PM, Enea Zaffanella <zaffanella at cs.unipr.it>
[...]
>> These outer template parameter lists can be present for both cases of a
>> friend declaration:
>> template <class T> class A<T>::B;
>> template <class T> void A<T>::B::foo();
>>
>> So I don't suggest adding this as ExtInfo in the FriendUnion.
>> Fortunately,
>> FriendDecl has no subclasses, and we know how many outer template
>> parameter lists there are when parsing it, so you can actually just store
>> the number of parameter lists in the class and tail-allocate the array of
>> template parameter lists.
>>
>> John.
>
> For the second case
>
> template <class T> friend void A<T>::B::foo();
>
> the outer template parameter list(s) are already stored inside the
> function declaration, namely in the QualifierInfo base class of
> DeclaratorDecl::ExtInfo.
>
> I think that friend *types* are the only cases where these outer
> template parameter lists are missing. Anyway, tail-allocation as
> suggested will be fine.
Please find attached a patch for review, including (de-)serialization
and pretty printing of the new info attached to friend type
declarations. On a second though, we kept the PointerUnion3 approach,
which seems to be simpler (at least, to my eyes) when it comes to
deserializing the declaration node.
Enea.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FriendDecl.patch
Type: text/x-diff
Size: 9989 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130125/a7bc852a/attachment.patch>
More information about the cfe-dev
mailing list