[clang] 684e4c0 - [clang][Interp] Don't explicitly call InterpState destructor()
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 24 03:01:01 PDT 2023
Author: Timm Bäder
Date: 2023-10-24T12:00:40+02:00
New Revision: 684e4c0085e8d454c04e9813f89033b1c51d24fa
URL: https://github.com/llvm/llvm-project/commit/684e4c0085e8d454c04e9813f89033b1c51d24fa
DIFF: https://github.com/llvm/llvm-project/commit/684e4c0085e8d454c04e9813f89033b1c51d24fa.diff
LOG: [clang][Interp] Don't explicitly call InterpState destructor()
This broke the msan builders because the destructor will be called
twice. Should've guessed.
Added:
Modified:
clang/lib/AST/Interp/Context.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/Interp/Context.cpp b/clang/lib/AST/Interp/Context.cpp
index 3ad63f40b0c72b7..cb96e56fb5e1ad8 100644
--- a/clang/lib/AST/Interp/Context.cpp
+++ b/clang/lib/AST/Interp/Context.cpp
@@ -158,17 +158,18 @@ const llvm::fltSemantics &Context::getFloatSemantics(QualType T) const {
}
bool Context::Run(State &Parent, const Function *Func, APValue &Result) {
- InterpState State(Parent, *P, Stk, *this);
- State.Current = new InterpFrame(State, Func, /*Caller=*/nullptr, {});
- if (Interpret(State, Result)) {
- assert(Stk.empty());
- return true;
- }
- // We explicitly delete our state here, so the Stk.clear() call
- // below doesn't violently free values the destructor would
- // otherwise access.
- State.~InterpState();
+ {
+ InterpState State(Parent, *P, Stk, *this);
+ State.Current = new InterpFrame(State, Func, /*Caller=*/nullptr, {});
+ if (Interpret(State, Result)) {
+ assert(Stk.empty());
+ return true;
+ }
+
+ // State gets destroyed here, so the Stk.clear() below doesn't accidentally
+ // remove values the State's destructor might accedd.
+ }
Stk.clear();
return false;
More information about the cfe-commits
mailing list