[clang] [WebKit Checkers] Trivial analysis should check destructors of function parameters and local variables (PR #181576)

Ryosuke Niwa via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 16 13:53:54 PST 2026


================
@@ -516,19 +516,35 @@ class TrivialFunctionAnalysisVisitor
     return Result;
   }
 
+  bool CanTriviallyDestruct(const Type *T) {
+    if (T->isIntegralOrEnumerationType())
+      return true;
+    if (isa<PointerType>(T) || T->isNullPtrType())
+      return true;
+    auto *R = T->getAsCXXRecordDecl();
+    if (!R)
+      return false;
+    auto *Dtor = R->getDestructor();
+    return !Dtor || Dtor->isTrivial() || IsFunctionTrivial(Dtor);
+  }
----------------
rniwa wrote:

Sure, changed to QualType.

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


More information about the cfe-commits mailing list