[clang] [Clang][ASTMatcher] Extend `hasDependentName` to match DependentNameType name (PR #121975)

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 7 23:40:42 PST 2025


================
@@ -2251,6 +2251,14 @@ TEST_P(ASTMatchersTest, HasDependentName_DependentScopeDeclRefExpr) {
   EXPECT_TRUE(matches("template <typename T> struct S { static T foo(); };"
                       "template <typename T> void x() { S<T>::foo(); }",
                       dependentScopeDeclRefExpr(hasDependentName("foo"))));
+
+  EXPECT_TRUE(matches(
+      R"(
+        template <typename T> struct declToImport {
+          typedef typename T::type dependent_name;
+        };
+      )",
+      dependentNameType(hasDependentName(("type")))));
----------------
HighCommander4 wrote:

nit: extra parentheses around `"type"` can be removed

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


More information about the cfe-commits mailing list