[clang] [WebKit Checkers] Honor using declarations when looking up protocol conformance (PR #223902)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 16 06:02:39 PDT 2026


================
@@ -30,6 +30,15 @@ bool hasPublicMethodInBaseClass(const CXXRecordDecl *R, StringRef NameToMatch) {
     if (MethodName == NameToMatch && MD->getAccess() == AS_public)
       return true;
   }
+
+  for (const Decl *D : R->decls()) {
+    const auto *Shadow = dyn_cast<UsingShadowDecl>(D);
+    if (!Shadow || Shadow->getAccess() != AS_public)
+      continue;
+    const auto *MD = dyn_cast_or_null<CXXMethodDecl>(Shadow->getTargetDecl());
----------------
steakhal wrote:

I think `Shadow->getTargetDecl()` can never be null:

```suggestion
    const auto *MD = dyn_cast<CXXMethodDecl>(Shadow->getTargetDecl());
```

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


More information about the cfe-commits mailing list