This change fixed function template instantiation if the template is
defined in a friend declaration inside a class template.
Instantiation of friend templates defined inline in general requires
knowledge of the class template specialization where the template body is
defined. For instance, in the code:
template<typename T> struct C { template<typename T1> friend void func(T1 *x) { T var; } }; C<int> v; void use(int *x) { func(x); }
To properly instantiate func it is necessary to know in which
particular specialization of the containing class C the function
template is defined, because its body depends on template parameter
of that class. However the pattern search made by
getTemplateInstantiationPattern end up with the definition in
template class and information about its specialization is lost.
Subsequent call to getTemplateInstantiationArgs does not have
actual information and cannot instantiate the function.
As a solution, this change adds additional argument to the function
getTemplateInstantiationPattern that is set to the class template
specialization if the function is defined in its friend declaration.
Similarly the function getTemplateInstantiationArgs gets additional
argument, which specifies this specialization.
This change fixes PR26512, PR19095 and PR34343.
"If this is non-null and the pattern is a friend function declaration, this is set to the class containing the friend declaration."