[cfe-commits] [PATCH] Utilize the indents in -ast-dump to draw structural information
Richard Trieu
rtrieu at google.com
Thu Jan 10 18:28:37 PST 2013
Instead of printing spaces at the beginning of a line, use '|', '-' and '\' to display the tree. This addition will make reading the AST easier, especially with line-spanning nodes.
Indenting:
Indenting is still handled by IndentScope. Instead of an unsigned, a vector is used to track the indent status. The vector is easily transformed to the proper output in indent().
Last Child:
Determining the last child of a node is important to printing the proper tree. Each caller is responsible to call lastChild() before each possible last child. In order to prevent multiple calls to lastChild() from messing up the indents, hasMoreChildren(true) can be called, which prevents the effects of lastChild() from taking effect. hasMoreChildren(false) will allow lastChild() to work again.
http://llvm-reviews.chandlerc.com/D281
Files:
utils/TableGen/ClangAttrEmitter.cpp
lib/AST/ASTDumper.cpp
test/Misc/ast-dump-decl.c
test/Misc/ast-dump-attr.cpp
test/Misc/ast-dump-stmt.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D281.1.patch
Type: text/x-patch
Size: 22206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130110/69fa09ba/attachment.bin>
More information about the cfe-commits
mailing list