Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a matcher for the name of a DependentScopeDeclRefExpr #121610

Closed
HighCommander4 opened this issue Jan 3, 2025 · 3 comments · Fixed by #121656
Closed

Add a matcher for the name of a DependentScopeDeclRefExpr #121610

HighCommander4 opened this issue Jan 3, 2025 · 3 comments · Fixed by #121656
Assignees
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema"

Comments

@HighCommander4
Copy link
Collaborator

In #120937 we added a new dependentScopeDeclRefExpr() matcher, for matching expression node of type DependentScopeDeclRefExpr.

To make this matcher more useful, it would be nice to have a matcher that can go inside dependentScopeDeclRefExpr() to narrow down the match to expressions referencing a particular name.

We have such a matcher for CXXDependentScopeMemberExpr, called hasMemberName(). I'm proposing we add something similar for DependentScopeDeclRefExpr.

We'll need to figure out what to name it. hasMemberName is not appropriate here, as DependentScopeDeclRefExpr does not necessarily name a class member. hasName sounds good but is already used for NamedDecl and I don't know how easy it would be to overload it. hasDependentName perhaps?

@HighCommander4 HighCommander4 added the clang:frontend Language frontend issues, e.g. anything involving "Sema" label Jan 3, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 3, 2025

@llvm/issue-subscribers-clang-frontend

Author: Nathan Ridge (HighCommander4)

In https://github.com//issues/120937 we added a new `dependentScopeDeclRefExpr()` matcher, for matching expression node of type `DependentScopeDeclRefExpr`.

To make this matcher more useful, it would be nice to have a matcher that can go inside dependentScopeDeclRefExpr() to narrow down the match to expressions referencing a particular name.

We have such a matcher for CXXDependentScopeMemberExpr, called [hasMemberName()](https://searchfox.org/llvm/rev/f87a9db8322643ccbc324e317a75b55903129b55/clang/include/clang/ASTMatchers/ASTMatchers.h#3186-3208). I'm proposing we add something similar for DependentScopeDeclRefExpr.

We'll need to figure out what to name it. hasMemberName is not appropriate here, as DependentScopeDeclRefExpr does not necessarily name a class member. hasName sounds good but [is already used](https://searchfox.org/llvm/rev/f87a9db8322643ccbc324e317a75b55903129b55/clang/include/clang/ASTMatchers/ASTMatchers.h#3100) for NamedDecl and I don't know how easy it would be to overload it. hasDependentName perhaps?

@HighCommander4
Copy link
Collaborator Author

@AmrDeveloper you might find this an interesting follow-up to #120937 to work on.

@AmrDeveloper
Copy link
Member

Cool, interested to work on it @HighCommander4, Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema"
Projects
None yet
3 participants