Expr: use class IntrusivePtr

As a side effect, this fixes lots of memory leaks in
`*Expr::InitVal()` because in most implementations, the `aggr`
parameter leaks.
This commit is contained in:
Max Kellermann 2020-02-26 19:12:57 +01:00
parent 7be3641f1d
commit c3ea246237
17 changed files with 885 additions and 1206 deletions

View file

@ -13,6 +13,7 @@
#include "Scope.h"
#include "Frame.h"
#include "Func.h"
#include "IntrusivePtr.h"
#include "Val.h"
#include "Stmt.h"
#include "Timer.h"
@ -246,7 +247,7 @@ BreakCode DbgBreakpoint::HasHit()
if ( condition.size() )
{
// TODO: ### evaluate using debugger frame too
Val* yes = dbg_eval_expr(condition.c_str());
auto yes = dbg_eval_expr(condition.c_str());
if ( ! yes )
{
@ -260,7 +261,6 @@ BreakCode DbgBreakpoint::HasHit()
if ( ! IsIntegral(yes->Type()->Tag()) &&
! IsBool(yes->Type()->Tag()) )
{
Unref(yes);
PrintHitMsg();
debug_msg("Breakpoint condition should return an integral type");
return bcHitAndDelete;
@ -269,11 +269,8 @@ BreakCode DbgBreakpoint::HasHit()
yes->CoerceToInt();
if ( yes->IsZero() )
{
Unref(yes);
return bcNoHit;
}
Unref(yes);
}
int repcount = GetRepeatCount();