================
@@ -3503,9 +3518,23 @@ bool FunctionDecl::isDestroyingOperatorDelete() const {
       getNumParams() < 2)
     return false;
 
-  auto *RD = getParamDecl(1)->getType()->getAsCXXRecordDecl();
-  return RD && RD->isInStdNamespace() && RD->getIdentifier() &&
-         RD->getIdentifier()->isStr("destroying_delete_t");
+  if (isTypeAwareOperatorNewOrDelete())
+    return false;
+
+  return getParamDecl(1)->getType()->isDestroyingDeleteT();
----------------
ojhunt wrote:

@cor3ntin @AaronBallman So part of my reason for this approach for 
`isTypeAwareOperatorNewOrDelete()` is to avoid the more expensive type checks 
in the common case of them not being type aware.

But to resolve the problems with `isDestroyingDeleteT` and `isTypeIdentity` 
needing a Sema reference in contexts where a Sema is not available is generally 
for queries on Function/CXXMethodDecl to determine if they're destroying or 
type aware delete, which could be resolved by spending a couple of bits on 
FunctionDecl to just record that directly - which would also help perf in a 
bunch of places.

https://github.com/llvm/llvm-project/pull/113510
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to