[PATCH] D85330: [SyntaxTree] Extend the syntax tree dump

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 21 03:37:23 PDT 2020


gribozavr2 added a comment.

Output format LGTM!



================
Comment at: clang/lib/Tooling/Syntax/Tree.cpp:160
+  assert(N);
+  if (auto *L = llvm::dyn_cast<syntax::Leaf>(N)) {
+    OS << "'";
----------------



================
Comment at: clang/lib/Tooling/Syntax/Tree.cpp:169
 
-  auto *T = cast<syntax::Tree>(N);
-  OS << T->kind() << "\n";
+  auto *T = llvm::cast<syntax::Tree>(N);
+  OS << T->kind();
----------------



================
Comment at: clang/lib/Tooling/Syntax/Tree.cpp:205
   traverse(this, [&](const syntax::Node *N) {
-    auto *L = dyn_cast<syntax::Leaf>(N);
-    if (!L)
-      return;
-    ::dumpTokens(OS, *L->token(), A.sourceManager());
-    OS << " ";
+    if (auto *L = llvm::dyn_cast<syntax::Leaf>(N)) {
+      dumpLeaf(OS, L, SM);
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85330/new/

https://reviews.llvm.org/D85330



More information about the cfe-commits mailing list