From 1aeb4c6b5081944fd1e53a8f6ee0488ca33644c1 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 14 Feb 2022 15:14:41 +0100 Subject: [PATCH] [ItaniumCXXABI] Avoid pointer element type accesses --- clang/lib/CodeGen/ItaniumCXXABI.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp index 2979d92..5ec9d32 100644 --- a/clang/lib/CodeGen/ItaniumCXXABI.cpp +++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp @@ -4472,7 +4472,7 @@ static void InitCatchParam(CodeGenFunction &CGF, // pad. The best solution is to fix the personality function. } else { // Pull the pointer for the reference type off. - llvm::Type *PtrTy = LLVMCatchTy->getPointerElementType(); + llvm::Type *PtrTy = CGF.ConvertTypeForMem(CaughtType); // Create the temporary and write the adjusted pointer into it. Address ExnPtrTmp = @@ -4555,7 +4555,7 @@ static void InitCatchParam(CodeGenFunction &CGF, if (!copyExpr) { llvm::Value *rawAdjustedExn = CallBeginCatch(CGF, Exn, true); Address adjustedExn(CGF.Builder.CreateBitCast(rawAdjustedExn, PtrTy), - caughtExnAlignment); + LLVMCatchTy, caughtExnAlignment); LValue Dest = CGF.MakeAddrLValue(ParamAddr, CatchType); LValue Src = CGF.MakeAddrLValue(adjustedExn, CatchType); CGF.EmitAggregateCopy(Dest, Src, CatchType, AggValueSlot::DoesNotOverlap); @@ -4569,7 +4569,7 @@ static void InitCatchParam(CodeGenFunction &CGF, // Cast that to the appropriate type. Address adjustedExn(CGF.Builder.CreateBitCast(rawAdjustedExn, PtrTy), - caughtExnAlignment); + LLVMCatchTy, caughtExnAlignment); // The copy expression is defined in terms of an OpaqueValueExpr. // Find it and map it to the adjusted expression. -- 2.7.4