aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Compiler.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-05-24 14:17:26 +0200
committerGitHub <noreply@github.com>2025-05-24 14:17:26 +0200
commit294643e4bdc843343ef20069a4d6d0de872b3303 (patch)
treed539a58519fc10b8f7e63f3293c827dcedb6e3ec /clang/lib/AST/ByteCode/Compiler.cpp
parent7cfdd74f0f25c0792047f3934c9e93ce1d4788e1 (diff)
downloadllvm-294643e4bdc843343ef20069a4d6d0de872b3303.zip
llvm-294643e4bdc843343ef20069a4d6d0de872b3303.tar.gz
llvm-294643e4bdc843343ef20069a4d6d0de872b3303.tar.bz2
[clang][bytecode] Check lifetime of all ptr bases in placement-new (#141272)
placement-new'ing an object with a dead base object is not allowed, so we need to check all the pointer bases.
Diffstat (limited to 'clang/lib/AST/ByteCode/Compiler.cpp')
-rw-r--r--clang/lib/AST/ByteCode/Compiler.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 54a4647..bf38b2e 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -4927,7 +4927,8 @@ bool Compiler<Emitter>::VisitCallExpr(const CallExpr *E) {
const auto *MemberCall = cast<CXXMemberCallExpr>(E);
if (!this->visit(MemberCall->getImplicitObjectArgument()))
return false;
- return this->emitCheckDestruction(E) && this->emitPopPtr(E);
+ return this->emitCheckDestruction(E) && this->emitEndLifetime(E) &&
+ this->emitPopPtr(E);
}
}
@@ -5016,7 +5017,7 @@ bool Compiler<Emitter>::VisitCallExpr(const CallExpr *E) {
return this->discard(Base);
if (!this->visit(Base))
return false;
- return this->emitKill(E);
+ return this->emitEndLifetimePop(E);
} else if (!FuncDecl) {
const Expr *Callee = E->getCallee();
CalleeOffset =