Skip to content

Commit 684e4c0

Browse files
committed
[clang][Interp] Don't explicitly call InterpState destructor()
This broke the msan builders because the destructor will be called twice. Should've guessed.
1 parent d68826d commit 684e4c0

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

clang/lib/AST/Interp/Context.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -158,17 +158,18 @@ const llvm::fltSemantics &Context::getFloatSemantics(QualType T) const {
158158
}
159159

160160
bool Context::Run(State &Parent, const Function *Func, APValue &Result) {
161-
InterpState State(Parent, *P, Stk, *this);
162-
State.Current = new InterpFrame(State, Func, /*Caller=*/nullptr, {});
163-
if (Interpret(State, Result)) {
164-
assert(Stk.empty());
165-
return true;
166-
}
167161

168-
// We explicitly delete our state here, so the Stk.clear() call
169-
// below doesn't violently free values the destructor would
170-
// otherwise access.
171-
State.~InterpState();
162+
{
163+
InterpState State(Parent, *P, Stk, *this);
164+
State.Current = new InterpFrame(State, Func, /*Caller=*/nullptr, {});
165+
if (Interpret(State, Result)) {
166+
assert(Stk.empty());
167+
return true;
168+
}
169+
170+
// State gets destroyed here, so the Stk.clear() below doesn't accidentally
171+
// remove values the State's destructor might accedd.
172+
}
172173

173174
Stk.clear();
174175
return false;

0 commit comments

Comments
 (0)