[clang-tools-extra] [clang][CodeGen] The `eh_typeid_for` intrinsic needs special care too (PR #65699)

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 10 05:55:22 PDT 2023


================
@@ -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);
----------------
yxsamliu wrote:

sorry I mean getTargetHooks().performAddrSpaceCast

https://github.com/llvm/llvm-project/pull/65699


More information about the cfe-commits mailing list