[PATCH] D76355: [Syntax] Build mapping from AST to syntax tree nodes

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 23 08:09:15 PDT 2020


gribozavr2 added inline comments.


================
Comment at: clang/include/clang/Tooling/Syntax/Tree.h:129
 
+  void SetRole(NodeRole NR);
+
----------------
`setRole()` (in new code).


================
Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:975
+      const syntax::Token *TemplateKW,
+      syntax::SimpleDeclaration *InnerDeclaration) {
     assert(!ExternKW || ExternKW->kind() == tok::kw_extern);
----------------
hlopko wrote:
> gribozavr2 wrote:
> > Add a `Decl *From` parameter and pass it through to `Builder.foldNode()` below?
> Done, but to get rid of all nullptr parents in BuildTree.cpp we'd have to implement support for Types in the AST mapping. Let's not do that in this patch.
For consistency with, for example, `foldTemplateDeclaration`, I think `Decl *From` should be the last parameter.


================
Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:264
 
+  /// getRange() finds the syntax tokens corresponding to the \p SourceRange.
+  llvm::ArrayRef<syntax::Token> getRange(SourceRange Range) const {
----------------
Don't repeat the function name in comments.

`/// Finds the syntax tokens that correspond to the provided \c SourceRange.`


================
Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:270
+
   /// getRange() finds the syntax tokens corresponding to the passed source
   /// locations.
----------------
Ditto.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76355





More information about the cfe-commits mailing list