aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-07-01 20:37:09 +0200
committerGitHub <noreply@github.com>2025-07-01 20:37:09 +0200
commitb54e02a40b3c99e205ece39ac7fe1c5168ed2c9b (patch)
treed26fb99f3a873322a2ab571093b3c2ac86c8425e /clang/lib/AST/ByteCode
parent8dbfe83681ed2066b3591be24c4a566b87177d12 (diff)
downloadllvm-b54e02a40b3c99e205ece39ac7fe1c5168ed2c9b.zip
llvm-b54e02a40b3c99e205ece39ac7fe1c5168ed2c9b.tar.gz
llvm-b54e02a40b3c99e205ece39ac7fe1c5168ed2c9b.tar.bz2
[clang][bytecode] Check pointer data type for bitcast eligibility (#146552)
So we get the proper type for a heap-allocated value.
Diffstat (limited to 'clang/lib/AST/ByteCode')
-rw-r--r--clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp b/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp
index 2569cac..feac97d 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp
@@ -335,7 +335,8 @@ bool clang::interp::DoBitCast(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
BitcastBuffer Buffer(FullBitWidth);
size_t BuffSize = FullBitWidth.roundToBytes();
- if (!CheckBitcastType(S, OpPC, Ptr.getType(), /*IsToType=*/false))
+ QualType DataType = Ptr.getFieldDesc()->getDataType(S.getASTContext());
+ if (!CheckBitcastType(S, OpPC, DataType, /*IsToType=*/false))
return false;
bool Success = readPointerToBuffer(S.getContext(), Ptr, Buffer,
@@ -370,8 +371,8 @@ bool clang::interp::DoBitCastPtr(InterpState &S, CodePtr OpPC,
assert(FromPtr.isBlockPointer());
assert(ToPtr.isBlockPointer());
- QualType FromType = FromPtr.getType();
- QualType ToType = ToPtr.getType();
+ QualType FromType = FromPtr.getFieldDesc()->getDataType(S.getASTContext());
+ QualType ToType = ToPtr.getFieldDesc()->getDataType(S.getASTContext());
if (!CheckBitcastType(S, OpPC, ToType, /*IsToType=*/true))
return false;