diff --git a/src/Expr.cc b/src/Expr.cc index eadefb59d9..3943786560 100644 --- a/src/Expr.cc +++ b/src/Expr.cc @@ -4179,7 +4179,7 @@ LambdaExpr::LambdaExpr(std::unique_ptr arg_ing, // Install a dummy version of the function globally for use only // when broker provides a closure. auto dummy_func = make_intrusive( - ingredients->id.get(), + ingredients->id, ingredients->body, ingredients->inits, ingredients->frame_size, @@ -4230,7 +4230,7 @@ Scope* LambdaExpr::GetScope() const IntrusivePtr LambdaExpr::Eval(Frame* f) const { auto lamb = make_intrusive( - ingredients->id.get(), + ingredients->id, ingredients->body, ingredients->inits, ingredients->frame_size, diff --git a/src/Func.cc b/src/Func.cc index e9bcd07455..e8a29612bb 100644 --- a/src/Func.cc +++ b/src/Func.cc @@ -268,7 +268,7 @@ void Func::CheckPluginResult(bool handled, const IntrusivePtr& hook_result, } } -BroFunc::BroFunc(ID* arg_id, IntrusivePtr arg_body, +BroFunc::BroFunc(const IntrusivePtr& arg_id, IntrusivePtr arg_body, const std::vector>& aggr_inits, size_t arg_frame_size, int priority) : Func(BRO_FUNC) diff --git a/src/Func.h b/src/Func.h index 56c4adf75b..f861171980 100644 --- a/src/Func.h +++ b/src/Func.h @@ -129,7 +129,7 @@ protected: class BroFunc final : public Func { public: - BroFunc(ID* id, IntrusivePtr body, + BroFunc(const IntrusivePtr& id, IntrusivePtr body, const std::vector>& inits, size_t frame_size, int priority); diff --git a/src/Var.cc b/src/Var.cc index b46956090f..af1665d92a 100644 --- a/src/Var.cc +++ b/src/Var.cc @@ -30,7 +30,7 @@ static IntrusivePtr init_val(Expr* init, const BroType* t, } } -static bool add_prototype(ID* id, BroType* t, +static bool add_prototype(const IntrusivePtr& id, BroType* t, std::vector>* attrs, const IntrusivePtr& init) { @@ -39,7 +39,7 @@ static bool add_prototype(ID* id, BroType* t, if ( ! IsFunc(t->Tag()) ) { - t->Error("type incompatible with previous definition", id); + t->Error("type incompatible with previous definition", id.get()); return false; } @@ -108,7 +108,7 @@ static bool add_prototype(ID* id, BroType* t, return true; } -static void make_var(ID* id, IntrusivePtr t, init_class c, +static void make_var(const IntrusivePtr& id, IntrusivePtr t, init_class c, IntrusivePtr init, std::unique_ptr>> attr, decl_type dt, @@ -308,8 +308,8 @@ static void make_var(ID* id, IntrusivePtr t, init_class c, } -void add_global(ID* id, IntrusivePtr t, init_class c, - IntrusivePtr init, +void add_global(const IntrusivePtr& id, IntrusivePtr t, + init_class c, IntrusivePtr init, std::unique_ptr>> attr, decl_type dt) { @@ -321,7 +321,7 @@ IntrusivePtr add_local(IntrusivePtr id, IntrusivePtr t, std::unique_ptr>> attr, decl_type dt) { - make_var(id.get(), std::move(t), c, init, std::move(attr), dt, false); + make_var(id, std::move(t), c, init, std::move(attr), dt, false); if ( init ) { @@ -352,7 +352,7 @@ extern IntrusivePtr add_and_assign_local(IntrusivePtr id, IntrusivePtr init, IntrusivePtr val) { - make_var(id.get(), nullptr, INIT_FULL, init, nullptr, VAR_REGULAR, false); + make_var(id, nullptr, INIT_FULL, init, nullptr, VAR_REGULAR, false); auto name_expr = make_intrusive(std::move(id)); return make_intrusive(std::move(name_expr), std::move(init), false, std::move(val)); @@ -646,7 +646,7 @@ void end_func(IntrusivePtr body) else { auto f = make_intrusive( - ingredients->id.get(), + ingredients->id, ingredients->body, ingredients->inits, ingredients->frame_size, diff --git a/src/Var.h b/src/Var.h index 7806e25585..935e276f86 100644 --- a/src/Var.h +++ b/src/Var.h @@ -17,7 +17,7 @@ class ListVal; typedef enum { VAR_REGULAR, VAR_CONST, VAR_REDEF, VAR_OPTION, } decl_type; -extern void add_global(ID* id, +extern void add_global(const IntrusivePtr& id, IntrusivePtr t, init_class c, IntrusivePtr init, diff --git a/src/parse.y b/src/parse.y index bfb403f97a..59b229bdca 100644 --- a/src/parse.y +++ b/src/parse.y @@ -1082,7 +1082,7 @@ decl: | TOK_GLOBAL def_global_id opt_type init_class opt_init opt_attr ';' { IntrusivePtr id{AdoptRef{}, $2}; - add_global(id.get(), {AdoptRef{}, $3}, $4, {AdoptRef{}, $5}, + add_global(id, {AdoptRef{}, $3}, $4, {AdoptRef{}, $5}, std::unique_ptr>>{$6}, VAR_REGULAR); zeekygen_mgr->Identifier(std::move(id)); @@ -1091,7 +1091,7 @@ decl: | TOK_OPTION def_global_id opt_type init_class opt_init opt_attr ';' { IntrusivePtr id{AdoptRef{}, $2}; - add_global(id.get(), {AdoptRef{}, $3}, $4, {AdoptRef{}, $5}, + add_global(id, {AdoptRef{}, $3}, $4, {AdoptRef{}, $5}, std::unique_ptr>>{$6}, VAR_OPTION); zeekygen_mgr->Identifier(std::move(id)); @@ -1100,7 +1100,7 @@ decl: | TOK_CONST def_global_id opt_type init_class opt_init opt_attr ';' { IntrusivePtr id{AdoptRef{}, $2}; - add_global(id.get(), {AdoptRef{}, $3}, $4, {AdoptRef{}, $5}, + add_global(id, {AdoptRef{}, $3}, $4, {AdoptRef{}, $5}, std::unique_ptr>>{$6}, VAR_CONST); zeekygen_mgr->Identifier(std::move(id)); @@ -1110,7 +1110,7 @@ decl: { IntrusivePtr id{AdoptRef{}, $2}; IntrusivePtr init{AdoptRef{}, $5}; - add_global(id.get(), {AdoptRef{}, $3}, $4, init, + add_global(id, {AdoptRef{}, $3}, $4, init, std::unique_ptr>>{$6}, VAR_REDEF); zeekygen_mgr->Redef(id.get(), ::filename, $4, std::move(init));