I am trying to use a template class justification libtoolingfor printing CXXRecordDeclwith a template template parameter. Unfortunately, the string representation of the template template parameter is not complete (for example, it skips namespaces).
I am printing CXXRecordDeclusing this code:
clang::PrintingPolicy policy = compiler_instance->getLangOpts();
std::string name = decl->getTypeForDecl()->getCanonicalTypeInternal().getAsString(policy);
Here is an example where I expect the output to be ns::A<ns::B>, but I get ns::A<B>:
namespace ns {
template <template <class> class T>
class A {
T<int> x;
};
template <class T>
class B {
T y;
};
}
int main(int argc, char **argv)
{
using namespace ns;
A<B> z;
}
How to print a fully qualified class name with a template template parameter?
In the corresponding note, is there a way to do this without a call getCanonicalTypeInternalthat sounds like an internal function?
[ # 1] decl->getQualifiedNameAsString(), ns::A.
[ # 2] Cling . . ( ). , ns::A<void (B)> ns::A<void (ns::B)>:
namespace ns {
class B { };
template <class T>
class A { };
}
int main(int argc, char **argv)
{
using namespace ns;
A<void (B)> x;
}
[ # 3] . : CERN. . .