Hi,<br><br>Attached patch implements an initial framework of a DeclContextPrinter. It can print DeclContext and its Decls in indented format. An Example:<br><br>$ cat 3.cpp<br>class A {<br> int a;<br> void f();<br>};<br>
void A::f() {<br> a = 3;<br>}<br><br>$ clang -print-decl-contexts 3.cpp<br>[translation unit] 0x9754d7c<br> <typedef> __builtin_va_list<br> [class] A 0x9753310<br> <class> A 0x975ce20<br> <field> a<br>
<c++ method> f<br> <c++ ctor> A<br> <c++ ctor> A<br> <c++ method> operator=<br> <c++ dtor> ~A<br> [c++ method] f [[0x9753310]]<br><br>Some comments: '<>' indicates a declaration, '[]' indicates a definition, '[[ ]]' displays the semantic DeclContext which is different from the lexical DeclContext. <br>
<br>This visualization should be helpful for DeclContext debugging.<br>