[cfe-dev] [Patch] DeclContext printer
Zhongxing Xu
xuzhongxing at gmail.com
Sat Jan 10 07:09:48 PST 2009
Hi,
Attached patch implements an initial framework of a DeclContextPrinter. It
can print DeclContext and its Decls in indented format. An Example:
$ cat 3.cpp
class A {
int a;
void f();
};
void A::f() {
a = 3;
}
$ clang -print-decl-contexts 3.cpp
[translation unit] 0x9754d7c
<typedef> __builtin_va_list
[class] A 0x9753310
<class> A 0x975ce20
<field> a
<c++ method> f
<c++ ctor> A
<c++ ctor> A
<c++ method> operator=
<c++ dtor> ~A
[c++ method] f [[0x9753310]]
Some comments: '<>' indicates a declaration, '[]' indicates a definition,
'[[ ]]' displays the semantic DeclContext which is different from the
lexical DeclContext.
This visualization should be helpful for DeclContext debugging.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090110/f5f2e305/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dcprinter.patch
Type: application/octet-stream
Size: 8549 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090110/f5f2e305/attachment.obj>
More information about the cfe-dev
mailing list