[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 02:41:58 PDT 2020


eduucaldas marked an inline comment as not done.
eduucaldas added inline comments.


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


================
Comment at: clang/include/clang/Tooling/Syntax/Nodes.h:209
+/// qualified-id:
+///   nested-name-specifier template_opt unqualified-id
+class IdExpression final : public Expression {
----------------
gribozavr2 wrote:
> Please add a TODO for the accessor for the 'template' keyword (and a test that has that keyword).
I can implement accessor. But I couldn't write a test with this template keyword that uses `DeclRefExpr`.  [[ https://godbolt.org/z/XWGuZP | This ]] is the test I came up with, note that both expressions are represented as `DependentScopeDeclRefExpr`


================
Comment at: clang/include/clang/Tooling/Syntax/Nodes.h:216
+  }
+
+  syntax::NestedNameSpecifier *qualifier();
----------------
Just by looking at code it is impossible to know if the accessed thing is optional or not. 
IdExpression ALWAYS has a UnqualifiedId
IdExpression MAY have a NestedNameSpecifier
This same issue repeats in other places


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