aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Compiler.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-09-16 10:02:18 +0200
committerGitHub <noreply@github.com>2025-09-16 10:02:18 +0200
commit29c55d0f7bb993668243efad0dbbc3fc1a9a5d2a (patch)
treea3267328226e316a0e83b6002a411f73f6664ca1 /clang/lib/AST/ByteCode/Compiler.cpp
parent7ba702195136b448d6f35ae3ea4075059cb0df82 (diff)
downloadllvm-29c55d0f7bb993668243efad0dbbc3fc1a9a5d2a.zip
llvm-29c55d0f7bb993668243efad0dbbc3fc1a9a5d2a.tar.gz
llvm-29c55d0f7bb993668243efad0dbbc3fc1a9a5d2a.tar.bz2
[clang][bytecode] Improve error detection in BitCastPrim op (#158575)
Reject bitcasts to pointer types unless it's to `nullptr_t` and always reject bitcasts to member pointer types. Fixes #156174
Diffstat (limited to 'clang/lib/AST/ByteCode/Compiler.cpp')
-rw-r--r--clang/lib/AST/ByteCode/Compiler.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index c9ce113..1340a84 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -7398,7 +7398,8 @@ bool Compiler<Emitter>::emitBuiltinBitCast(const CastExpr *E) {
uint32_t ResultBitWidth = std::max(Ctx.getBitWidth(ToType), 8u);
if (!this->emitBitCastPrim(*ToT, ToTypeIsUChar || ToType->isStdByteType(),
- ResultBitWidth, TargetSemantics, E))
+ ResultBitWidth, TargetSemantics,
+ ToType.getTypePtr(), E))
return false;
if (DiscardResult)