[PATCH] D55488: Add utility for dumping a label with child nodes
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 9 07:21:15 PST 2019
aaron.ballman added a comment.
@rsmith -- do you have opinions on the new format for how we display the child node? I think this is a more clear approach, but a second opinion would be nice.
================
Comment at: include/clang/AST/TextNodeDumper.h:43
+ /// Add a child of the current node.
+ /// Calls doAddChild without arguments
+ template <typename Fn>
----------------
Why move this comment down a line? Might as well leave it where it was before (feel free to add a full stop to the end of the comment though).
================
Comment at: include/clang/AST/TextNodeDumper.h:45
+ template <typename Fn>
+ void addChild(Fn doAddChild) {
+ return addChild("", doAddChild);
----------------
doAddChild -> DoAddChild
================
Comment at: include/clang/AST/TextNodeDumper.h:48
+ }
+ /// Add a child of the current node with an optional label.
+ /// Calls doAddChild without arguments.
----------------
Can you add a newline above this comment to give it some visual space?
================
Comment at: include/clang/AST/TextNodeDumper.h:51
+ template <typename Fn>
+ void addChild(StringRef Label, Fn doAddChild) {
// If we're at the top level, there's nothing interesting to do; just
----------------
doAddChild -> DoAddChild
================
Comment at: include/clang/AST/TextNodeDumper.h:68
+ // We need to capture an owning-string in the lambda because the lambda
+ // is invoked in a deffered manner.
+ std::string LabelStr = Label;
----------------
deffered -> deferred
================
Comment at: include/clang/AST/TextNodeDumper.h:70
+ std::string LabelStr = Label;
+ auto dumpWithIndent = [this, doAddChild, LabelStr](bool isLastChild) {
// Print out the appropriate tree structure and work out the prefix for
----------------
dumpWithIndent -> DumpWithIndent
isLastChild -> IsLastChild
================
Comment at: include/clang/AST/TextNodeDumper.h:87
OS << Prefix << (isLastChild ? '`' : '|') << '-';
+ if (!LabelStr.empty()) {
+ OS << LabelStr << ": ";
----------------
Elide braces
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55488/new/
https://reviews.llvm.org/D55488
More information about the cfe-commits
mailing list