Scope: pass IntrusivePtr to AddInit()

This commit is contained in:
Max Kellermann 2020-03-06 13:02:15 +01:00
parent 9e00c28e48
commit 6e0d331267
2 changed files with 2 additions and 2 deletions

View file

@ -73,7 +73,7 @@ public:
id_list* GetInits(); id_list* GetInits();
// Adds a variable to the list. // Adds a variable to the list.
void AddInit(ID* id) { inits->push_back(id); } void AddInit(IntrusivePtr<ID> &&id) { inits->push_back(id.release()); }
void Describe(ODesc* d) const override; void Describe(ODesc* d) const override;

View file

@ -254,7 +254,7 @@ IntrusivePtr<Stmt> add_local(IntrusivePtr<ID> id, IntrusivePtr<BroType> t,
else else
{ {
current_scope()->AddInit(id.release()); current_scope()->AddInit(std::move(id));
return make_intrusive<NullStmt>(); return make_intrusive<NullStmt>();
} }
} }