diff options
Diffstat (limited to 'clang/lib/CIR/CodeGen/CIRGenFunction.cpp')
| -rw-r--r-- | clang/lib/CIR/CodeGen/CIRGenFunction.cpp | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/clang/lib/CIR/CodeGen/CIRGenFunction.cpp b/clang/lib/CIR/CodeGen/CIRGenFunction.cpp index 706c14ae962a..e2181b8222aa 100644 --- a/clang/lib/CIR/CodeGen/CIRGenFunction.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenFunction.cpp @@ -206,8 +206,10 @@ bool CIRGenFunction::constantFoldsToSimpleInteger(const Expr *cond, void CIRGenFunction::emitAndUpdateRetAlloca(QualType type, mlir::Location loc, CharUnits alignment) { if (!type->isVoidType()) { - fnRetAlloca = emitAlloca("__retval", convertType(type), loc, alignment, - /*insertIntoFnEntryBlock=*/false); + mlir::Value addr = emitAlloca("__retval", convertType(type), loc, alignment, + /*insertIntoFnEntryBlock=*/false); + fnRetAlloca = addr; + returnValue = Address(addr, alignment); } } @@ -356,12 +358,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); } @@ -659,6 +657,8 @@ void CIRGenFunction::emitDestructorBody(FunctionArgList &args) { // we'd introduce *two* handler blocks. In the Microsoft ABI, we // always delegate because we might not have a definition in this TU. switch (dtorType) { + case Dtor_Unified: + llvm_unreachable("not expecting a unified dtor"); case Dtor_Comdat: llvm_unreachable("not expecting a COMDAT"); case Dtor_Deleting: @@ -752,7 +752,7 @@ clang::QualType CIRGenFunction::buildFunctionArgList(clang::GlobalDecl gd, args.push_back(param); if (md && (isa<CXXConstructorDecl>(md) || isa<CXXDestructorDecl>(md))) - assert(!cir::MissingFeatures::cxxabiStructorImplicitParam()); + cgm.getCXXABI().addImplicitStructorParams(*this, retTy, args); return retTy; } @@ -829,14 +829,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())) { |
