gribozavr2 added inline comments.

================
Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:173
+private:
+  // Keys are either Stmt* or Decl*.
+  llvm::DenseMap<ASTPtr, syntax::Tree *> Nodes;
----------------
The comment is not needed anymore.


================
Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:490
+        if (C->role() == NodeRole::Detached)
+          C->Role = static_cast<unsigned>(NodeRole::Unknown);
+        Node->prependChildLowLevel(C);
----------------
Could you add a private setter that performs this cast? (The cast is repeated 
at least 3 times in this patch.)


================
Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:570
+      auto *N = new (allocator()) syntax::SimpleDeclarator;
+      Builder.foldNode(Builder.getRange(R.getBegin(), R.getEnd()), N, D);
+      Builder.markChild(N, syntax::NodeRole::SimpleDeclaration_declarator);
----------------
It might make sense to add a helper `Builder.getRange(SourceRange)` and 
simplify these calls to `Builder.getRange(something.getBegin(), 
something.getEnd())` throughout the patch.


================
Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:975
+      const syntax::Token *TemplateKW,
+      syntax::SimpleDeclaration *InnerDeclaration) {
     assert(!ExternKW || ExternKW->kind() == tok::kw_extern);
----------------
Add a `Decl *From` parameter and pass it through to `Builder.foldNode()` below?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76355



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to