[clang] [alpha.webkit.UncountedCallArgsChecker] Allow protector functions in Objective-C++ (PR #108184)

Ryosuke Niwa via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 11 12:06:01 PDT 2024


================
@@ -143,6 +143,16 @@ bool isReturnValueRefCounted(const clang::FunctionDecl *F) {
   return false;
 }
 
+std::optional<bool> isUncounted(const QualType T) {
+  if (auto *Subst = dyn_cast<SubstTemplateTypeParmType>(T)) {
+    if (auto *Decl = Subst->getAssociatedDecl()) {
+      if (isRefType(safeGetName(Decl)))
+        return false;
+    }
+  }
+  return isUncounted(T->getAsCXXRecordDecl());
+}
+
 std::optional<bool> isUncounted(const CXXRecordDecl* Class)
----------------
rniwa wrote:

So the only other place where this function is called is in `isUncountedPtr` but that function needs to evaluate whether the pointee is ref counted or not so I don't think we can use the new function.

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


More information about the cfe-commits mailing list