[clang] [RFC] Initial implementation of P2719 (PR #113510)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 1 07:07:43 PDT 2024
================
@@ -2968,6 +3161,29 @@ bool Sema::FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range,
// deallocation function will be called.
if (Matches.size() == 1) {
OperatorDelete = Matches[0].second;
+ if (IsTypeAwareOperatorNewOrDelete(OperatorDelete) !=
+ IAP.PassTypeIdentity) {
+ Diag(StartLoc, diag::warn_mismatching_type_aware_cleanup_deallocator);
+ int NewDiagIndex = IsTypeAwareOperatorNewOrDelete(OperatorNew) ? 0 : 1;
+ int DeleteDiagIndex =
+ IsTypeAwareOperatorNewOrDelete(OperatorDelete) ? 0 : 1;
+ Diag(OperatorNew->getLocation(), diag::note_type_aware_operator_declared)
+ << NewDiagIndex << OperatorNew->getDeclName();
----------------
AaronBallman wrote:
The diagnostics engine knows how to print named declarations, so I think you can drop the `getDeclName()` calls when emitting these diagnostics.
https://github.com/llvm/llvm-project/pull/113510
More information about the cfe-commits
mailing list