================
@@ -2886,6 +2887,16 @@ class CXXDestructorDecl : public CXXMethodDecl {
return getCanonicalDecl()->OperatorDelete;
}
+ const FunctionDecl *getOperatorGlobalDelete() const {
+ return getCanonicalDecl()->OperatorGlobalDelete;
+ }
+
+ void setOperatorGlobalDelete(FunctionDecl *OD) {
+ auto *First = cast<CXXDestructorDecl>(getCanonicalDecl());
+ if (OD && !First->OperatorGlobalDelete)
+ First->OperatorGlobalDelete = OD;
----------------
tahonermann wrote:
I think a call to `setOperatorGlobalDelete(nullptr)` should clear
`OperatorGlobalDelete`.
Hmm, `setOperatorDelete()` silently ignores a call that passes `nullptr`. That
seems wrong. Maybe there should be a non-null assertion?
`setOperatorDelete()` also registers the delete operator with
`ASTMutationListener::ResolvedOperatorDelete()` and `ASTWriter` overrides that
function. That seems important for PCH and module support. I think updates are
needed to `clang/lib/Serialization/ASTReaderDecl.cpp` as well to restore
`OperatorGlobalDelete` during AST deserialization; see
`ASTDeclReader::VisitCXXDestructorDecl()` and `ASTDeclReader::UpdateDecl()` for
assignments to `OperatorDelete`.
https://github.com/llvm/llvm-project/pull/139566
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits