[clang] [Clang][ASTMatcher] Add a matcher for the name of a DependentScopeDeclRefExpr (PR #121656)

Amr Hesham via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 5 05:11:45 PST 2025


================
@@ -2235,6 +2235,21 @@ TEST_P(ASTMatchersTest, ArgumentCountIs_CXXConstructExpr) {
                  Constructor1Arg));
 }
 
+TEST_P(ASTMatchersTest, hasDependentName_DependentScopeDeclRefExpr) {
+  if (!GetParam().isCXX() || GetParam().hasDelayedTemplateParsing()) {
+    // FIXME: Fix this test to work with delayed template parsing.
+    return;
+  }
+
+  EXPECT_TRUE(matches("template <class T> class X : T { void f() { T::v; } };",
+                      dependentScopeDeclRefExpr(hasDependentName("v"))));
+
+  EXPECT_TRUE(
----------------
AmrDeveloper wrote:

Done, thank you for suggesting it :D

https://github.com/llvm/llvm-project/pull/121656


More information about the cfe-commits mailing list