tracking of expressions used to define/redef variables

This commit is contained in:
Vern Paxson 2021-04-19 16:03:29 -07:00
parent 1f15f53f4b
commit cf79c05e3a
3 changed files with 21 additions and 1 deletions

View file

@ -244,6 +244,8 @@ static void build_global(ID* id, Type* t, InitClass ic, Expr* e,
add_global(id_ptr, std::move(t_ptr), ic, e_ptr, std::move(attrs_ptr), dt);
id->AddInitExpr(e_ptr);
if ( dt == VAR_REDEF )
zeekygen_mgr->Redef(id, ::filename, ic, std::move(e_ptr));
else
@ -261,7 +263,9 @@ static StmtPtr build_local(ID* id, Type* t, InitClass ic, Expr* e,
auto attrs_ptr = attrs ? std::make_unique<std::vector<AttrPtr>>(*attrs) : nullptr;
auto init = add_local(std::move(id_ptr), std::move(t_ptr), ic,
std::move(e_ptr), std::move(attrs_ptr), dt);
e_ptr, std::move(attrs_ptr), dt);
id->AddInitExpr(std::move(e_ptr));
if ( do_coverage )
script_coverage_mgr.AddStmt(init.get());