If a module contains opaque type and another one contains definition
of equivalent type in sense of C++, llvm-link merges these types.
In this procedure it can rely only on type name. An issue arises if
the type is a class template specialization. See the example.
File 1
template<typename T> struct ABC; ABC<int> *var_1;
File 2
template<typename T> struct ABC { T *f; }; extern ABC<int> var_1; ABC<int*> var_2;
llvm-link produces module:
%struct.ABC = type { i32** } @var_1 = global %struct.ABC* null, align 8 @var_2 = global %struct.ABC zeroinitializer, align 8
Incomplete type ABC<int> from the first module becomes ABC<int*>. It
happens because structure types obtained from template specialization
share the same type name and differ from each other only by version
suffixes, in the example the types are named as ABC and ABC.0.
llvm-link cannot correctly merge these types.
This change enables template arguments in class template specializations.
Clang already prints them in class context, now they will appear in the
class name itself.