================ @@ -1149,7 +1149,10 @@ static void emitCatchDispatchBlock(CodeGenFunction &CGF, assert(handler.Type.Flags == 0 && "landingpads do not support catch handler flags"); assert(typeValue && "fell into catch-all case!"); - typeValue = CGF.Builder.CreateBitCast(typeValue, CGF.Int8PtrTy); + llvm::Type *argTy = llvm_eh_typeid_for->getArg(0)->getType(); + // With opaque ptrs, only the address space can be a mismatch. + if (typeValue->getType() != argTy) + typeValue = CGF.Builder.CreateAddrSpaceCast(typeValue, argTy); ---------------- AlexVlx wrote:
We can, I've only used the builder for symmetry (everything else uses direct emission) and convenience (we already have the LLVM types handy). I'll switch it over to the hook, and hoist the intrinsic arg type retrieval since it doesn't need to be in the loop. https://github.com/llvm/llvm-project/pull/65699 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits