mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 02:28:21 +00:00
Move IntrusivePtr and utility methods to the zeek namespace
This commit is contained in:
parent
4668378d91
commit
9364e6a5b7
255 changed files with 3761 additions and 3730 deletions
36
src/Scope.cc
36
src/Scope.cc
|
@ -15,8 +15,8 @@ typedef PList<Scope> scope_list;
|
|||
static scope_list scopes;
|
||||
static Scope* top_scope;
|
||||
|
||||
Scope::Scope(IntrusivePtr<zeek::detail::ID> id,
|
||||
std::unique_ptr<std::vector<IntrusivePtr<zeek::detail::Attr>>> al)
|
||||
Scope::Scope(zeek::IntrusivePtr<zeek::detail::ID> id,
|
||||
std::unique_ptr<std::vector<zeek::IntrusivePtr<zeek::detail::Attr>>> al)
|
||||
: scope_id(std::move(id)), attrs(std::move(al))
|
||||
{
|
||||
return_type = nullptr;
|
||||
|
@ -35,7 +35,7 @@ Scope::Scope(IntrusivePtr<zeek::detail::ID> id,
|
|||
}
|
||||
}
|
||||
|
||||
const IntrusivePtr<zeek::detail::ID>& Scope::Find(std::string_view name) const
|
||||
const zeek::IntrusivePtr<zeek::detail::ID>& Scope::Find(std::string_view name) const
|
||||
{
|
||||
auto entry = local.find(name);
|
||||
|
||||
|
@ -45,7 +45,7 @@ const IntrusivePtr<zeek::detail::ID>& Scope::Find(std::string_view name) const
|
|||
return zeek::detail::ID::nil;
|
||||
}
|
||||
|
||||
IntrusivePtr<zeek::detail::ID> Scope::Remove(std::string_view name)
|
||||
zeek::IntrusivePtr<zeek::detail::ID> Scope::Remove(std::string_view name)
|
||||
{
|
||||
auto entry = local.find(name);
|
||||
|
||||
|
@ -59,12 +59,12 @@ IntrusivePtr<zeek::detail::ID> Scope::Remove(std::string_view name)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
IntrusivePtr<zeek::detail::ID> Scope::GenerateTemporary(const char* name)
|
||||
zeek::IntrusivePtr<zeek::detail::ID> Scope::GenerateTemporary(const char* name)
|
||||
{
|
||||
return make_intrusive<zeek::detail::ID>(name, zeek::detail::SCOPE_FUNCTION, false);
|
||||
return zeek::make_intrusive<zeek::detail::ID>(name, zeek::detail::SCOPE_FUNCTION, false);
|
||||
}
|
||||
|
||||
std::vector<IntrusivePtr<zeek::detail::ID>> Scope::GetInits()
|
||||
std::vector<zeek::IntrusivePtr<zeek::detail::ID>> Scope::GetInits()
|
||||
{
|
||||
auto rval = std::move(inits);
|
||||
inits = {};
|
||||
|
@ -119,9 +119,10 @@ TraversalCode Scope::Traverse(TraversalCallback* cb) const
|
|||
}
|
||||
|
||||
|
||||
const IntrusivePtr<zeek::detail::ID>& lookup_ID(const char* name, const char* curr_module,
|
||||
bool no_global, bool same_module_only,
|
||||
bool check_export)
|
||||
const zeek::IntrusivePtr<zeek::detail::ID>& lookup_ID(
|
||||
const char* name, const char* curr_module,
|
||||
bool no_global, bool same_module_only,
|
||||
bool check_export)
|
||||
{
|
||||
std::string fullname = make_full_var_name(curr_module, name);
|
||||
|
||||
|
@ -153,8 +154,9 @@ const IntrusivePtr<zeek::detail::ID>& lookup_ID(const char* name, const char* cu
|
|||
return zeek::detail::ID::nil;
|
||||
}
|
||||
|
||||
IntrusivePtr<zeek::detail::ID> install_ID(const char* name, const char* module_name,
|
||||
bool is_global, bool is_export)
|
||||
zeek::IntrusivePtr<zeek::detail::ID> install_ID(
|
||||
const char* name, const char* module_name,
|
||||
bool is_global, bool is_export)
|
||||
{
|
||||
if ( scopes.empty() && ! is_global )
|
||||
reporter->InternalError("local identifier in global scope");
|
||||
|
@ -171,7 +173,7 @@ IntrusivePtr<zeek::detail::ID> install_ID(const char* name, const char* module_n
|
|||
|
||||
std::string full_name = make_full_var_name(module_name, name);
|
||||
|
||||
auto id = make_intrusive<zeek::detail::ID>(full_name.data(), scope, is_export);
|
||||
auto id = zeek::make_intrusive<zeek::detail::ID>(full_name.data(), scope, is_export);
|
||||
|
||||
if ( zeek::detail::SCOPE_FUNCTION != scope )
|
||||
global_scope()->Insert(std::move(full_name), id);
|
||||
|
@ -189,14 +191,14 @@ void push_existing_scope(Scope* scope)
|
|||
scopes.push_back(scope);
|
||||
}
|
||||
|
||||
void push_scope(IntrusivePtr<zeek::detail::ID> id,
|
||||
std::unique_ptr<std::vector<IntrusivePtr<zeek::detail::Attr>>> attrs)
|
||||
void push_scope(zeek::IntrusivePtr<zeek::detail::ID> id,
|
||||
std::unique_ptr<std::vector<zeek::IntrusivePtr<zeek::detail::Attr>>> attrs)
|
||||
{
|
||||
top_scope = new Scope(std::move(id), std::move(attrs));
|
||||
scopes.push_back(top_scope);
|
||||
}
|
||||
|
||||
IntrusivePtr<Scope> pop_scope()
|
||||
zeek::IntrusivePtr<Scope> pop_scope()
|
||||
{
|
||||
if ( scopes.empty() )
|
||||
reporter->InternalError("scope underflow");
|
||||
|
@ -206,7 +208,7 @@ IntrusivePtr<Scope> pop_scope()
|
|||
|
||||
top_scope = scopes.empty() ? nullptr : scopes.back();
|
||||
|
||||
return {AdoptRef{}, old_top};
|
||||
return {zeek::AdoptRef{}, old_top};
|
||||
}
|
||||
|
||||
Scope* current_scope()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue