[PATCH] D137787: [CodeGen] Relax assertion on generating destructor call

Jonas Hahnfeld via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 10 07:34:10 PST 2022


Hahnfeld created this revision.
Hahnfeld added reviewers: v.g.vassilev, mantognini, ChuanqiXu, Bigcheese.
Herald added a project: All.
Hahnfeld requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

If the `Decl` pointers are not identical, `declaresSameEntity` will check the canonical `Decls`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137787

Files:
  clang/lib/CodeGen/CGExprCXX.cpp


Index: clang/lib/CodeGen/CGExprCXX.cpp
===================================================================
--- clang/lib/CodeGen/CGExprCXX.cpp
+++ clang/lib/CodeGen/CGExprCXX.cpp
@@ -97,8 +97,9 @@
   const CXXMethodDecl *DtorDecl = cast<CXXMethodDecl>(Dtor.getDecl());
 
   assert(!ThisTy.isNull());
-  assert(ThisTy->getAsCXXRecordDecl() == DtorDecl->getParent() &&
-         "Pointer/Object mixup");
+  assert(
+      declaresSameEntity(ThisTy->getAsCXXRecordDecl(), DtorDecl->getParent()) &&
+      "Pointer/Object mixup");
 
   LangAS SrcAS = ThisTy.getAddressSpace();
   LangAS DstAS = DtorDecl->getMethodQualifiers().getAddressSpace();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137787.474545.patch
Type: text/x-patch
Size: 642 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221110/cf391d9f/attachment.bin>


More information about the cfe-commits mailing list