[clang] [analyzer][NFC] Build the AST matchers of GCDAntipattern and OSObjectCStyleCast once (PR #246981)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 29 06:45:50 PST 2026


================
@@ -110,8 +111,16 @@ void OSObjectCStyleCastChecker::checkASTCodeBody(const Decl *D,
                           unless(anyOf(DynamicCastM, AllocClassWithNameM))))))
           .bind(WarnAtNode);
 
-  auto Matches =
-      match(stmt(forEachDescendant(CastM)), *D->getBody(), AM.getASTContext());
+  return stmt(forEachDescendant(CastM));
+}
+
+void OSObjectCStyleCastChecker::checkASTCodeBody(const Decl *D,
+                                                 AnalysisManager &AM,
+                                                 BugReporter &BR) const {
+
----------------
steakhal wrote:

```suggestion
```

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


More information about the cfe-commits mailing list