Skip to content

Commit 9203e21

Browse files
committed
Use getDefinitionOrSelf in CIRGenTypes
1 parent 295489f commit 9203e21

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

clang/lib/CIR/CodeGen/CIRGenTypes.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ isSafeToConvert(QualType qt, CIRGenTypes &cgt,
185185

186186
// If this is a record, check it.
187187
if (const auto *rt = qt->getAs<RecordType>())
188-
return isSafeToConvert(rt->getOriginalDecl(), cgt, alreadyChecked);
188+
return isSafeToConvert(rt->getOriginalDecl()->getDefinitionOrSelf(), cgt,
189+
alreadyChecked);
189190

190191
// If this is an array, check the elements, which are embedded inline.
191192
if (const auto *at = cgt.getASTContext().getAsArrayType(qt))
@@ -464,7 +465,8 @@ mlir::Type CIRGenTypes::convertType(QualType type) {
464465
}
465466

466467
case Type::Enum: {
467-
const EnumDecl *ed = cast<EnumType>(ty)->getOriginalDecl();
468+
const EnumDecl *ed =
469+
cast<EnumType>(ty)->getOriginalDecl()->getDefinitionOrSelf();
468470
if (auto integerType = ed->getIntegerType(); !integerType.isNull())
469471
return convertType(integerType);
470472
// Return a placeholder 'i32' type. This can be changed later when the
@@ -555,7 +557,7 @@ bool CIRGenTypes::isZeroInitializable(clang::QualType t) {
555557
}
556558

557559
if (const RecordType *rt = t->getAs<RecordType>()) {
558-
const RecordDecl *rd = rt->getOriginalDecl();
560+
const RecordDecl *rd = rt->getOriginalDecl()->getDefinitionOrSelf();
559561
return isZeroInitializable(rd);
560562
}
561563

0 commit comments

Comments
 (0)