aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGExprAgg.cpp
diff options
context:
space:
mode:
authorMatheus Izvekov <mizvekov@gmail.com>2025-08-27 06:20:14 -0300
committerGitHub <noreply@github.com>2025-08-27 06:20:14 -0300
commit88438ba1f37fa4e0c2db203cd5556e52c9c34c08 (patch)
tree7fb96d5778f8b5f6c6bc258182c1f743a2f0d5da /clang/lib/CodeGen/CGExprAgg.cpp
parentf6d2fcc7a64250d3a6fe2365f0b2d600f0ece887 (diff)
downloadllvm-88438ba1f37fa4e0c2db203cd5556e52c9c34c08.zip
llvm-88438ba1f37fa4e0c2db203cd5556e52c9c34c08.tar.gz
llvm-88438ba1f37fa4e0c2db203cd5556e52c9c34c08.tar.bz2
[clang] AST: fix getAs canonicalization of leaf types (#155028)
Diffstat (limited to 'clang/lib/CodeGen/CGExprAgg.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprAgg.cpp5
1 files changed, 3 insertions, 2 deletions
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<RecordType>()) {
+ if (const RecordType *RT = E->getType()->getAsCanonical<RecordType>()) {
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<RecordType>()) {
+ .getBaseElementType(E->getType())
+ ->getAsCanonical<RecordType>()) {
const CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getOriginalDecl());
if (RD->hasUserDeclaredConstructor())
return;