[PATCH] D55488: Add utility for dumping a label with child nodes

Stephen Kelly via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 10 13:51:05 PST 2018


steveire added inline comments.


================
Comment at: lib/AST/ASTDumper.cpp:89
     void dumpDecl(const Decl *D);
-    void dumpStmt(const Stmt *S);
+    void dumpStmt(const Stmt *S, const std::string &label = {});
 
----------------
aaron.ballman wrote:
> Label
> 
> Rather than using `{}`, how about `""` (same behavior, but looks more idiomatic).
> 
> Why `std::string` instead of `StringRef`? I expect this will be called mostly with string literals, which saves an allocation. The other labels are using `const char *`, which would be another reasonable option. Whatever we go with, it'd be nice to make the label types agree across the calls.
The actual print in TextTreeStructure is deferred, so it can't be `const char*` or `StringRef`.


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