From 88438ba1f37fa4e0c2db203cd5556e52c9c34c08 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Wed, 27 Aug 2025 06:20:14 -0300 Subject: [clang] AST: fix getAs canonicalization of leaf types (#155028) --- clang/lib/CodeGen/CGExprAgg.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'clang/lib/CodeGen/CGExprAgg.cpp') diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index 5057536..b8150a2 100644 --- a/clang/lib/CodeGen/CGExprAgg.cpp +++ b/clang/lib/CodeGen/CGExprAgg.cpp @@ -2114,7 +2114,7 @@ static CharUnits GetNumNonZeroBytesInInit(const Expr *E, CodeGenFunction &CGF) { // InitListExprs for structs have to be handled carefully. If there are // reference members, we need to consider the size of the reference, not the // referencee. InitListExprs for unions and arrays can't have references. - if (const RecordType *RT = E->getType()->getAs()) { + if (const RecordType *RT = E->getType()->getAsCanonical()) { if (!RT->isUnionType()) { RecordDecl *SD = RT->getOriginalDecl()->getDefinitionOrSelf(); CharUnits NumNonZeroBytes = CharUnits::Zero(); @@ -2167,7 +2167,8 @@ static void CheckAggExprForMemSetUse(AggValueSlot &Slot, const Expr *E, // C++ objects with a user-declared constructor don't need zero'ing. if (CGF.getLangOpts().CPlusPlus) if (const RecordType *RT = CGF.getContext() - .getBaseElementType(E->getType())->getAs()) { + .getBaseElementType(E->getType()) + ->getAsCanonical()) { const CXXRecordDecl *RD = cast(RT->getOriginalDecl()); if (RD->hasUserDeclaredConstructor()) return; -- cgit v1.1