[PATCH] D81168: Add support for DeclRefExpr in SyntaxTree, by generating IdExpressions

Eduardo Caldas via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 18 09:46:10 PDT 2020


eduucaldas marked 2 inline comments as done.
eduucaldas added inline comments.


================
Comment at: clang/include/clang/Tooling/Syntax/Nodes.h:190
+    return N->kind() == NodeKind::NameSpecifier;
+  }
+};
----------------
eduucaldas wrote:
> gribozavr2 wrote:
> > Should there be getters for various parts of the specifier?
> I think not.
Pospone to interface discussion with Yitzhak


================
Comment at: clang/include/clang/Tooling/Syntax/Nodes.h:214
+    return N->kind() == NodeKind::UnqualifiedId;
+  }
+};
----------------
gribozavr2 wrote:
> Could you add TODOs about adding accessors?
Pospone to interface discussion with Yitzhak


================
Comment at: clang/lib/Tooling/Syntax/Nodes.cpp:178
 }
 
+std::vector<syntax::NameSpecifier *> syntax::NestedNameSpecifier::specifiers() {
----------------
I was thinking and our problem is bigger than not testing for `NodeRole`s, we don't test accessors at all!


================
Comment at: clang/lib/Tooling/Syntax/Nodes.cpp:182
+  for (auto *C = firstChild(); C; C = C->nextSibling()) {
+    if (C->role() == syntax::NodeRole::NestedNameSpecifier_specifier)
+      Children.push_back(llvm::cast<syntax::NameSpecifier>(C));
----------------
This should be an assert for now, as if that is not true it would be a logic problem. Same reasoning applies to `CompoundStatement`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81168





More information about the cfe-commits mailing list