aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CIR/CodeGen/CIRGenFunction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CIR/CodeGen/CIRGenFunction.cpp')
-rw-r--r--clang/lib/CIR/CodeGen/CIRGenFunction.cpp19
1 files changed, 5 insertions, 14 deletions
diff --git a/clang/lib/CIR/CodeGen/CIRGenFunction.cpp b/clang/lib/CIR/CodeGen/CIRGenFunction.cpp
index 706c14a..deabb94 100644
--- a/clang/lib/CIR/CodeGen/CIRGenFunction.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenFunction.cpp
@@ -356,12 +356,8 @@ static bool mayDropFunctionReturn(const ASTContext &astContext,
QualType returnType) {
// We can't just discard the return value for a record type with a complex
// destructor or a non-trivially copyable type.
- if (const RecordType *recordType =
- returnType.getCanonicalType()->getAs<RecordType>()) {
- if (const auto *classDecl = dyn_cast<CXXRecordDecl>(
- recordType->getOriginalDecl()->getDefinitionOrSelf()))
- return classDecl->hasTrivialDestructor();
- }
+ if (const auto *classDecl = returnType->getAsCXXRecordDecl())
+ return classDecl->hasTrivialDestructor();
return returnType.isTriviallyCopyableType(astContext);
}
@@ -829,14 +825,9 @@ std::string CIRGenFunction::getCounterAggTmpAsString() {
void CIRGenFunction::emitNullInitialization(mlir::Location loc, Address destPtr,
QualType ty) {
// Ignore empty classes in C++.
- if (getLangOpts().CPlusPlus) {
- if (const RecordType *rt = ty->getAs<RecordType>()) {
- if (cast<CXXRecordDecl>(rt->getOriginalDecl())
- ->getDefinitionOrSelf()
- ->isEmpty())
- return;
- }
- }
+ if (getLangOpts().CPlusPlus)
+ if (const auto *rd = ty->getAsCXXRecordDecl(); rd && rd->isEmpty())
+ return;
// Cast the dest ptr to the appropriate i8 pointer type.
if (builder.isInt8Ty(destPtr.getElementType())) {