[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2025-01-09 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman closed https://github.com/llvm/llvm-project/pull/118800 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2025-01-09 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/118800 >From 34d3d3000bc6096bbc9eb35ce85b6ceca50b91ca Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Thu, 5 Dec 2024 08:31:24 -0500 Subject: [PATCH 1/8] [C++20] Destroying delete and deleted destructors When

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2025-01-09 Thread Aaron Ballman via cfe-commits
@@ -2855,6 +2855,11 @@ class CXXDestructorDecl : public CXXMethodDecl { return getCanonicalDecl()->OperatorDeleteThisArg; } + /// Will this destructor ever be called when considering which deallocation + /// function is associated with the destructor? Can optionally be

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2025-01-08 Thread Richard Smith via cfe-commits
@@ -2855,6 +2855,11 @@ class CXXDestructorDecl : public CXXMethodDecl { return getCanonicalDecl()->OperatorDeleteThisArg; } + /// Will this destructor ever be called when considering which deallocation + /// function is associated with the destructor? Can optionally be

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2025-01-08 Thread Richard Smith via cfe-commits
https://github.com/zygoloid approved this pull request. LG other than the function name. https://github.com/llvm/llvm-project/pull/118800 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commit

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2025-01-08 Thread Richard Smith via cfe-commits
https://github.com/zygoloid edited https://github.com/llvm/llvm-project/pull/118800 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2025-01-08 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/118800 >From 34d3d3000bc6096bbc9eb35ce85b6ceca50b91ca Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Thu, 5 Dec 2024 08:31:24 -0500 Subject: [PATCH 1/7] [C++20] Destroying delete and deleted destructors When

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2025-01-08 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff f69585235ec85d54e0f3fc41b2d5700430907f99 0b146469bac8cde0b487deb2026ddc46db1da104 --e

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2025-01-08 Thread Aaron Ballman via cfe-commits
@@ -1200,21 +1200,35 @@ CanThrowResult Sema::canThrow(const Stmt *S) { case Expr::CXXDeleteExprClass: { auto *DE = cast(S); -CanThrowResult CT; +CanThrowResult CT = CT_Cannot; QualType DTy = DE->getDestroyedType(); if (DTy.isNull() || DTy->isDependentTy

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2025-01-08 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/118800 >From 34d3d3000bc6096bbc9eb35ce85b6ceca50b91ca Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Thu, 5 Dec 2024 08:31:24 -0500 Subject: [PATCH 1/6] [C++20] Destroying delete and deleted destructors When

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2025-01-08 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/118800 >From 34d3d3000bc6096bbc9eb35ce85b6ceca50b91ca Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Thu, 5 Dec 2024 08:31:24 -0500 Subject: [PATCH 1/5] [C++20] Destroying delete and deleted destructors When

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2025-01-07 Thread Richard Smith via cfe-commits
@@ -1200,21 +1200,35 @@ CanThrowResult Sema::canThrow(const Stmt *S) { case Expr::CXXDeleteExprClass: { auto *DE = cast(S); -CanThrowResult CT; +CanThrowResult CT = CT_Cannot; QualType DTy = DE->getDestroyedType(); if (DTy.isNull() || DTy->isDependentTy

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2025-01-07 Thread Richard Smith via cfe-commits
https://github.com/zygoloid edited https://github.com/llvm/llvm-project/pull/118800 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2025-01-07 Thread Richard Smith via cfe-commits
https://github.com/zygoloid edited https://github.com/llvm/llvm-project/pull/118800 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2025-01-07 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: Ping @zygoloid https://github.com/llvm/llvm-project/pull/118800 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2024-12-09 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: FYI, I'm going to be out on vacation after today, so if this is ready to land, someone else can feel free to press the button. Otherwise, I can pick this up again when I'm back. https://github.com/llvm/llvm-project/pull/118800 ___

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2024-12-06 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/118800 >From 34d3d3000bc6096bbc9eb35ce85b6ceca50b91ca Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Thu, 5 Dec 2024 08:31:24 -0500 Subject: [PATCH 1/4] [C++20] Destroying delete and deleted destructors When

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2024-12-05 Thread Richard Smith via cfe-commits
https://github.com/zygoloid edited https://github.com/llvm/llvm-project/pull/118800 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2024-12-05 Thread Richard Smith via cfe-commits
@@ -3768,6 +3768,28 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, DeclarationName DeleteName = Context.DeclarationNames.getCXXOperatorName( ArrayForm ? OO_Array_Delete : OO_Delete); +// C++20 [expr.delete]p6: If

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2024-12-05 Thread Aaron Ballman via cfe-commits
@@ -3768,6 +3768,28 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, DeclarationName DeleteName = Context.DeclarationNames.getCXXOperatorName( ArrayForm ? OO_Array_Delete : OO_Delete); +// C++20 [expr.delete]p6: If

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2024-12-05 Thread Richard Smith via cfe-commits
zygoloid wrote: As I just noted in #118687, I think we also need similar treatment for `noexcept(delete p)`. https://github.com/llvm/llvm-project/pull/118800 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailma

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2024-12-05 Thread Richard Smith via cfe-commits
@@ -3768,6 +3768,28 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, DeclarationName DeleteName = Context.DeclarationNames.getCXXOperatorName( ArrayForm ? OO_Array_Delete : OO_Delete); +// C++20 [expr.delete]p6: If

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2024-12-05 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/118800 >From 34d3d3000bc6096bbc9eb35ce85b6ceca50b91ca Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Thu, 5 Dec 2024 08:31:24 -0500 Subject: [PATCH 1/4] [C++20] Destroying delete and deleted destructors When

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2024-12-05 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/118800 >From 34d3d3000bc6096bbc9eb35ce85b6ceca50b91ca Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Thu, 5 Dec 2024 08:31:24 -0500 Subject: [PATCH 1/3] [C++20] Destroying delete and deleted destructors When

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2024-12-05 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/118800 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2024-12-05 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/118800 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2024-12-05 Thread Aaron Ballman via cfe-commits
@@ -23,3 +30,14 @@ struct alignas(Align) B { }; void f(B<__STDCPP_DEFAULT_NEW_ALIGNMENT__> *p) { delete p; } void f(B<__STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2> *p) { delete p; } // expected-error {{deleted}} + +// Ensure that a deleted destructor is acceptable when the selected ov

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2024-12-05 Thread Aaron Ballman via cfe-commits
@@ -3792,13 +3792,15 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, .HasSizeT; } - if (!PointeeRD->hasIrrelevantDestructor()) + if (!PointeeRD->hasIrrelevantDestructor() && AaronBallman wrote: Done https://git

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2024-12-05 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/118800 >From 34d3d3000bc6096bbc9eb35ce85b6ceca50b91ca Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Thu, 5 Dec 2024 08:31:24 -0500 Subject: [PATCH 1/2] [C++20] Destroying delete and deleted destructors When

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2024-12-05 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/118800 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2024-12-05 Thread Erich Keane via cfe-commits
@@ -3792,13 +3792,15 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, .HasSizeT; } - if (!PointeeRD->hasIrrelevantDestructor()) + if (!PointeeRD->hasIrrelevantDestructor() && erichkeane wrote: Would love a standa

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2024-12-05 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: 1 nit, else LGTM. https://github.com/llvm/llvm-project/pull/118800 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2024-12-05 Thread via cfe-commits
@@ -23,3 +30,14 @@ struct alignas(Align) B { }; void f(B<__STDCPP_DEFAULT_NEW_ALIGNMENT__> *p) { delete p; } void f(B<__STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2> *p) { delete p; } // expected-error {{deleted}} + +// Ensure that a deleted destructor is acceptable when the selected ov

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2024-12-05 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Aaron Ballman (AaronBallman) Changes When a destroying delete overload is selected, the destructor is not automatically called. Therefore, the destructor can be deleted without causing the program to be ill-formed. --- Full diff: https:/

[clang] [C++20] Destroying delete and deleted destructors (PR #118800)

2024-12-05 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman created https://github.com/llvm/llvm-project/pull/118800 When a destroying delete overload is selected, the destructor is not automatically called. Therefore, the destructor can be deleted without causing the program to be ill-formed. >From 34d3d3000bc6096bbc9e