Generally speaking, using TypePrinter is the most flexible mechanism for
printing types. It makes sense to have this feature just for this
reason.
However, this is also done in another context:
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20200518/321225.html
In a nutshell, getFullyQualifiedName is bugged and prints
::tensorfn::Nested< ::std::variant<Tensor, DeviceTensor> >
instead of:
::tensorfn::Nested< ::std::variant<::tensorflow::Tensor,::tensorfn::DeviceTensor> >
I was not able to fix this function, and intend to add this feature and
then start to remove the use of the other function (in CLIF first).
Longer term, we should delete QualTypeNames.cpp, and prefer
TypePrinter.
Things that are not that clear:
- should more types than classes and struct be globally qualified?
structure-or-class-type isn't quite the right check:
It's going to be hard to get this right from here... I suspect it's better to fix where FullyQualifiedName is checked in DeclPrinter.
This ultimately calls through to NamedDecl::printNestedNameSpecifier, which is probably the right place to respect this option.
(I don't totally understand what's meant to happen if SuppressScope is false but FullyQualiifedName is also false, that calls through to NestedNameSpecifier::print which you may want to also fix, or not)