[PATCH] D140807: [clang][Interp] Skip calling simple destructors
Timm Bäder via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Dec 31 09:21:08 PST 2022
tbaeder created this revision.
tbaeder added reviewers: aaron.ballman, erichkeane, tahonermann, shafik.
Herald added a project: All.
tbaeder requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Calling them isn't needed if I understand correctly.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D140807
Files:
clang/lib/AST/Interp/ByteCodeExprGen.h
Index: clang/lib/AST/Interp/ByteCodeExprGen.h
===================================================================
--- clang/lib/AST/Interp/ByteCodeExprGen.h
+++ clang/lib/AST/Interp/ByteCodeExprGen.h
@@ -364,14 +364,16 @@
if (!RDecl)
continue;
- if (const auto *DtorDecl = RDecl->getDestructor()) {
- const Function *Dtor = this->Ctx->getFunction(DtorDecl);
- if (Dtor && Dtor->isConstexpr()) {
- assert(Dtor->hasThisPointer());
- assert(Dtor->getNumParams() == 1);
- // Emit destructor call.
- this->Ctx->emitGetPtrLocal(Local.Offset, DtorDecl);
- this->Ctx->emitCall(Dtor, DtorDecl);
+ if (!RDecl->hasSimpleDestructor()) {
+ if (const auto *DtorDecl = RDecl->getDestructor()) {
+ const Function *Dtor = this->Ctx->getFunction(DtorDecl);
+ if (Dtor && Dtor->isConstexpr()) {
+ assert(Dtor->hasThisPointer());
+ assert(Dtor->getNumParams() == 1);
+ // Emit destructor call.
+ this->Ctx->emitGetPtrLocal(Local.Offset, DtorDecl);
+ this->Ctx->emitCall(Dtor, DtorDecl);
+ }
}
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140807.485780.patch
Type: text/x-patch
Size: 1174 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221231/3e3dd920/attachment.bin>
More information about the cfe-commits
mailing list