[PATCH] D87749: [SyntaxTree][Synthesis] Implement `deepCopy`

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 21 00:26:45 PDT 2020


gribozavr2 added inline comments.


================
Comment at: clang/lib/Tooling/Syntax/Synthesis.cpp:216
+       Child = Child->getNextSibling())
+    if (!Child->canModify())
+      return false;
----------------
Shouldn't we call canModifyAllDescendants recursively?


================
Comment at: clang/lib/Tooling/Syntax/Synthesis.cpp:228
+  const auto *T = cast<syntax::Tree>(N);
+  auto Children = std::vector<std::pair<syntax::Node *, syntax::NodeRole>>();
+  for (const auto *Child = T->getFirstChild(); Child;
----------------



================
Comment at: clang/lib/Tooling/Syntax/Synthesis.cpp:239
+  if (!canModifyAllDescendants(N))
+    return nullptr;
+
----------------
Could you add tests for deepCopy returning nullptr?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87749



More information about the cfe-commits mailing list