================ @@ -11139,6 +11139,21 @@ bool Sema::CheckDestructor(CXXDestructorDecl *Destructor) { DiagnoseUseOfDecl(OperatorDelete, Loc); MarkFunctionReferenced(Loc, OperatorDelete); Destructor->setOperatorDelete(OperatorDelete, ThisArg); + + if (isa<CXXMethodDecl>(OperatorDelete) && + Context.getTargetInfo().getCXXABI().isMicrosoft()) { + // In Microsoft ABI whenever a class has a defined operator delete, + // scalar deleting destructors check the 3rd bit of the implicit + // parameter and if it is set, then, global operator delete must be + // called instead of class-specific one. Find and save global operator + // for that case. Do not diagnose because even if we fail to find the + // operator, it won't be possible to compile and execute the code that + // requires it. ---------------- tahonermann wrote:
Suggested edits. ```suggestion // In Microsoft ABI whenever a class has a defined operator delete, // scalar deleting destructors check the 3rd bit of the implicit // parameter and if it is set, then, global operator delete must be // called instead of the class-specific one. Find and save the global operator // delete for that case. Do not diagnose at this point because the // lack of a global operator delete is not an error if there are no // delete calls that require it. ``` https://github.com/llvm/llvm-project/pull/139566 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits