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/CodeGenFunction.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp') diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 9854dae..b2fe917 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -2221,14 +2221,9 @@ static void emitNonZeroVLAInit(CodeGenFunction &CGF, QualType baseType, void CodeGenFunction::EmitNullInitialization(Address DestPtr, QualType Ty) { // Ignore empty classes in C++. - if (getLangOpts().CPlusPlus) { - if (const RecordType *RT = Ty->getAs()) { - if (cast(RT->getOriginalDecl()) - ->getDefinitionOrSelf() - ->isEmpty()) - return; - } - } + if (getLangOpts().CPlusPlus) + if (const auto *RD = Ty->getAsCXXRecordDecl(); RD && RD->isEmpty()) + return; if (DestPtr.getElementType() != Int8Ty) DestPtr = DestPtr.withElementType(Int8Ty); -- cgit v1.1