diff options
author | Timm Baeder <tbaeder@redhat.com> | 2025-05-16 12:48:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-16 12:48:22 +0200 |
commit | e5f8998ac86f3cbbc763f0a1a9e23824e70b4af7 (patch) | |
tree | ae2bbd12d8ba63987997f7ece9338fb526158875 /clang/lib/AST/ByteCode/Compiler.cpp | |
parent | 711d72e38ecc5a9b605ae9bf2dbc9c3f34d8aca5 (diff) | |
download | llvm-e5f8998ac86f3cbbc763f0a1a9e23824e70b4af7.zip llvm-e5f8998ac86f3cbbc763f0a1a9e23824e70b4af7.tar.gz llvm-e5f8998ac86f3cbbc763f0a1a9e23824e70b4af7.tar.bz2 |
[clang][bytecode] Explicitly start variable lifetimes via placement new (#140221)
placement new /std::construct{,_at} can resurrect a variable after it's
destructor has been called.
Diffstat (limited to 'clang/lib/AST/ByteCode/Compiler.cpp')
-rw-r--r-- | clang/lib/AST/ByteCode/Compiler.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index 2580fb1..5017c9b 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -3478,6 +3478,8 @@ bool Compiler<Emitter>::VisitCXXNewExpr(const CXXNewExpr *E) { if (PlacementDest) { if (!this->visit(PlacementDest)) return false; + if (!this->emitStartLifetime(E)) + return false; if (!this->emitGetLocal(SizeT, ArrayLen, E)) return false; if (!this->emitCheckNewTypeMismatchArray(SizeT, E, E)) @@ -3617,6 +3619,8 @@ bool Compiler<Emitter>::VisitCXXNewExpr(const CXXNewExpr *E) { if (PlacementDest) { if (!this->visit(PlacementDest)) return false; + if (!this->emitStartLifetime(E)) + return false; if (!this->emitCheckNewTypeMismatch(E, E)) return false; } else { |