[clang] [clang][Sema] Function effect analysis was missing the implicit call to the destructor in a CXXDeleteExpr. (PR #184460)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 6 17:04:53 PDT 2026


================
@@ -1255,15 +1255,23 @@ class Analyzer {
     }
 
     bool VisitCXXDeleteExpr(CXXDeleteExpr *Delete) override {
+      FunctionDecl *OpDelete = Delete->getOperatorDelete();
+
+      // RecursiveASTVisitor does not visit the called destructor.
+      // But a destroying operator delete means that no destructor is called.
+      if (OpDelete == nullptr || !OpDelete->isDestroyingOperatorDelete()) {
----------------
Sirraide wrote:

Hmm, I suppose it can be null. In that case, what this means is that we call `followTypeDtor()` if it is not a destroying delete, or if the operator delete is null, but then that means that if it _is_ a destroying delete _and_ the operator is null, then we _do_ call `followTypeDtor()`... which doesn’t seem right, though also I’m not sure that’s possible. Regardless, I feel like we should change the condition from `OpDelete == nullptr || !OpDelete->isDestroyingOperatorDelete()` to just `!OpDelete->isDestroyingOperatorDelete()`.

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


More information about the cfe-commits mailing list