Currently when invoking lldb-test symbols -dump-ast it parses all the debug symbols and calls print(...) on the TranslationUnitDecl.
While useful the TranslationUnitDecl::print(...) method gives us a higher level view then the dump from ASTDumper which is what we get when we invoke dump() on a specific AST node.
The main motivation for this change is allow us to verify that the AST nodes we create when we parse DWARF. For example in order to verify we are correctly using DIFlagExportSymbols added by D66667 we would want to dump a CXXRecordDecl:
CXXRecordDecl 0x7fdc578295f8 <<invalid sloc>> <invalid sloc> struct definition |-DefinitionData is_anonymous pass_in_registers aggregate standard_layout trivially_copyable pod trivial literal ...
and check for the is_anonymous flag or the lack thereof.
My current approach is to enumerate the symbols and to obtain specific AST nodes if possible and dump them. It looks in some cases such as FunctionDecls we don't have direct access to it but I don't think that is an major problem at this point.
I did not implement it but we should probably have a way of request a specific type instead of indiscriminately dumping all of them.
This is a work in progress and I am not sure if the following is the best approach and I am open to alternative approaches or modification to the current one.
nit: stray whitespace