TextNodeDumper currently doesn't support printing the TypeLoc hierarchy, which makes navigating clang-query output involving TypeLoc hard to understand.
This diff replicates the Type hierarchy as well as possible, relying on Type visitors for printing type-specific info.
The only exception where this doesn't work is most sugared types and any kinds of parameters (function or template), for which the TypeLoc is not easily accessible.
Example clang-query output:
clang-query> set output dump clang-query> match typeLoc(loc(type().bind("type"))) ... Binding for "root": QualifiedTypeLoc </home/tribizel/llvm-project/build/test.cpp:23:10, col:60> 'matrix::Dense<typename remove_complex_t<T>::type> *const' const `-PointerTypeLoc <col:10, col:60> 'matrix::Dense<typename remove_complex_t<T>::type> *' `-ElaboratedTypeLoc <col:10, col:58> 'matrix::Dense<typename remove_complex_t<T>::type>' `-TemplateSpecializationTypeLoc <col:18, col:58> 'Dense<typename remove_complex_t<T>::type>' Dense Binding for "type": PointerType 0x261f2b0 'matrix::Dense<typename remove_complex_t<T>::type> *' dependent `-ElaboratedType 0x261f250 'matrix::Dense<typename remove_complex_t<T>::type>' sugar dependent `-TemplateSpecializationType 0x261f210 'Dense<typename remove_complex_t<T>::type>' dependent Dense `-TemplateArgument type 'typename remove_complex_t<T>::type' `-DependentNameType 0x261f190 'typename remove_complex_t<T>::type' dependent
I don't know that we need a color specific to type locs; those should behave the same as a type node (after all, it's a type coupled with a source location, basically).