[clang] [CIR] Implement Statement Expressions (PR #153677)
Henrich Lauko via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 18 07:17:00 PDT 2025
================
@@ -1178,11 +1178,11 @@ static void pushTemporaryCleanup(CIRGenFunction &cgf,
->getBaseElementTypeUnsafe()
->getAs<clang::RecordType>()) {
// Get the destructor for the reference temporary.
- auto *classDecl =
- cast<CXXRecordDecl>(rt->getOriginalDecl()->getDefinitionOrSelf());
- if (!classDecl->hasTrivialDestructor())
- referenceTemporaryDtor =
- classDecl->getDefinitionOrSelf()->getDestructor();
+ if (const auto *classDecl = dyn_cast<CXXRecordDecl>(
+ rt->getOriginalDecl()->getDefinitionOrSelf())) {
+ if (!classDecl->hasTrivialDestructor())
+ referenceTemporaryDtor = classDecl->getDestructor();
----------------
xlauko wrote:
Why does this differ to traditional codegen, i.e. https://github.com/llvm/llvm-project/blob/0e52092ff7c1e1a1283fe8c232dd221a170e3fdc/clang/lib/CodeGen/CGExpr.cpp#L407
where this is in switch below with slightly different implementation.
https://github.com/llvm/llvm-project/pull/153677
More information about the cfe-commits
mailing list