From dc8596d5485a52abee2967cec72f81ef4872270c Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Mon, 25 Aug 2025 20:18:56 -0300 Subject: [clang] NFC: change more places to use Type::getAsTagDecl and friends (#155313) This changes a bunch of places which use getAs, including derived types, just to obtain the tag definition. This is preparation for #155028, offloading all the changes that PR used to introduce which don't depend on any new helpers. --- clang/lib/CodeGen/CGExprCXX.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'clang/lib/CodeGen/CGExprCXX.cpp') diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp index 57d7eecc62ee..b6868c1fb1f4 100644 --- a/clang/lib/CodeGen/CGExprCXX.cpp +++ b/clang/lib/CodeGen/CGExprCXX.cpp @@ -1973,9 +1973,7 @@ static bool EmitObjectDelete(CodeGenFunction &CGF, // Find the destructor for the type, if applicable. If the // destructor is virtual, we'll just emit the vcall and return. const CXXDestructorDecl *Dtor = nullptr; - if (const RecordType *RT = ElementType->getAs()) { - auto *RD = - cast(RT->getOriginalDecl())->getDefinitionOrSelf(); + if (const auto *RD = ElementType->getAsCXXRecordDecl()) { if (RD->hasDefinition() && !RD->hasTrivialDestructor()) { Dtor = RD->getDestructor(); -- cgit v1.2.3