zeekygen/IdentifierInfo: use class IntrusivePtr more

With this in place, we can eliminate the manually imeplemented copy
constructor/operator.
This commit is contained in:
Max Kellermann 2020-03-02 19:41:18 +01:00
parent a0c831a1bd
commit 78712d009f
5 changed files with 22 additions and 49 deletions

View file

@ -7,6 +7,7 @@
#include "PackageInfo.h"
#include "ScriptInfo.h"
#include "IdentifierInfo.h"
#include "Expr.h"
#include <utility>
#include <cstdlib>
@ -359,7 +360,7 @@ void Manager::RecordField(const ID* id, const TypeDecl* field,
}
void Manager::Redef(const ID* id, const string& path,
init_class ic, Expr* init_expr)
init_class ic, IntrusivePtr<Expr> init_expr)
{
if ( disabled )
return;
@ -387,7 +388,7 @@ void Manager::Redef(const ID* id, const string& path,
return;
}
id_info->AddRedef(from_script, ic, init_expr, comment_buffer);
id_info->AddRedef(from_script, ic, std::move(init_expr), comment_buffer);
script_info->AddRedef(id_info);
comment_buffer.clear();
last_identifier_seen = id_info;
@ -395,6 +396,12 @@ void Manager::Redef(const ID* id, const string& path,
id->Name(), from_script.c_str());
}
void Manager::Redef(const ID* id, const std::string& path,
init_class ic)
{
Redef(id, path, ic, nullptr);
}
void Manager::SummaryComment(const string& script, const string& comment)
{
if ( disabled )