Move ID to the zeek::detail namespace

This commit is contained in:
Tim Wojtulewicz 2020-05-18 18:16:25 -07:00
parent 9992ec5c11
commit 0d623d003c
30 changed files with 221 additions and 182 deletions

View file

@ -7,8 +7,8 @@
FORWARD_DECLARE_NAMESPACED(Expr, zeek::detail);
typedef PList<zeek::detail::Expr> expr_list;
class ID;
typedef PList<ID> id_list;
FORWARD_DECLARE_NAMESPACED(ID, zeek::detail);
typedef PList<zeek::detail::ID> id_list;
class Val;
typedef PList<Val> val_list;

View file

@ -30,13 +30,13 @@ using namespace std;
//
// Helper routines
//
bool string_is_regex(const string& s)
static bool string_is_regex(const string& s)
{
return strpbrk(s.data(), "?*\\+");
}
void lookup_global_symbols_regex(const string& orig_regex, vector<ID*>& matches,
bool func_only = false)
static void lookup_global_symbols_regex(const string& orig_regex, vector<zeek::detail::ID*>& matches,
bool func_only = false)
{
if ( streq(orig_regex.c_str(), "") )
return;
@ -61,18 +61,18 @@ void lookup_global_symbols_regex(const string& orig_regex, vector<ID*>& matches,
Scope* global = global_scope();
const auto& syms = global->Vars();
ID* nextid;
zeek::detail::ID* nextid;
for ( const auto& sym : syms )
{
ID* nextid = sym.second.get();
zeek::detail::ID* nextid = sym.second.get();
if ( ! func_only || nextid->GetType()->Tag() == TYPE_FUNC )
if ( ! regexec (&re, nextid->Name(), 0, 0, 0) )
matches.push_back(nextid);
}
}
void choose_global_symbols_regex(const string& regex, vector<ID*>& choices,
bool func_only = false)
static void choose_global_symbols_regex(const string& regex, vector<zeek::detail::ID*>& choices,
bool func_only = false)
{
lookup_global_symbols_regex(regex, choices, func_only);
@ -111,7 +111,7 @@ void choose_global_symbols_regex(const string& regex, vector<ID*>& choices,
int option = atoi(input.c_str());
if ( option > 0 && option <= (int) choices.size() )
{
ID* choice = choices[option - 1];
zeek::detail::ID* choice = choices[option - 1];
choices.clear();
choices.push_back(choice);
return;
@ -398,7 +398,7 @@ int dbg_cmd_break(DebugCmd cmd, const vector<string>& args)
vector<string> locstrings;
if ( string_is_regex(args[0]) )
{
vector<ID*> choices;
vector<zeek::detail::ID*> choices;
choose_global_symbols_regex(args[0], choices, true);
for ( unsigned int i = 0; i < choices.size(); ++i )
locstrings.push_back(choices[i]->Name());

View file

@ -77,7 +77,7 @@ void Frame::SetElementWeak(int n, Val* v)
frame[n] = {{AdoptRef{}, v}, true};
}
void Frame::SetElement(const ID* id, IntrusivePtr<Val> v)
void Frame::SetElement(const zeek::detail::ID* id, IntrusivePtr<Val> v)
{
if ( closure )
{
@ -106,7 +106,7 @@ void Frame::SetElement(const ID* id, IntrusivePtr<Val> v)
SetElement(id->Offset(), std::move(v));
}
const IntrusivePtr<Val>& Frame::GetElementByID(const ID* id) const
const IntrusivePtr<Val>& Frame::GetElementByID(const zeek::detail::ID* id) const
{
if ( closure )
{
@ -478,7 +478,7 @@ void Frame::AddKnownOffsets(const id_list& ids)
offset_map = std::make_unique<OffsetMap>();
std::transform(ids.begin(), ids.end(), std::inserter(*offset_map, offset_map->end()),
[] (const ID* id) -> std::pair<std::string, int>
[] (const zeek::detail::ID* id) -> std::pair<std::string, int>
{
return std::make_pair(std::string(id->Name()), id->Offset());
});
@ -523,10 +523,10 @@ void Frame::ClearElement(int n)
frame[n] = {nullptr, false};
}
bool Frame::IsOuterID(const ID* in) const
bool Frame::IsOuterID(const zeek::detail::ID* in) const
{
return std::any_of(outer_ids.begin(), outer_ids.end(),
[&in](ID* id)-> bool { return strcmp(id->Name(), in->Name()) == 0; });
[&in](zeek::detail::ID* id)-> bool { return strcmp(id->Name(), in->Name()) == 0; });
}
broker::expected<broker::data> Frame::SerializeIDList(const id_list& in)
@ -588,7 +588,7 @@ Frame::UnserializeIDList(const broker::vector& data)
return std::make_pair(false, std::move(rval));
}
ID* id = new ID(has_name->c_str(), SCOPE_FUNCTION, false);
auto* id = new zeek::detail::ID(has_name->c_str(), zeek::detail::SCOPE_FUNCTION, false);
id->SetOffset(*has_offset);
rval.push_back(id);
std::advance(where, 1);

View file

@ -66,8 +66,8 @@ public:
* @param id the ID to associate
* @param v the value to associate it with
*/
void SetElement(const ID* id, IntrusivePtr<Val> v);
void SetElement(const IntrusivePtr<ID>& id, IntrusivePtr<Val> v)
void SetElement(const zeek::detail::ID* id, IntrusivePtr<Val> v);
void SetElement(const IntrusivePtr<zeek::detail::ID>& id, IntrusivePtr<Val> v)
{ SetElement(id.get(), std::move(v)); }
/**
@ -77,11 +77,11 @@ public:
* @param id the id who's value to retreive
* @return the value associated with *id*
*/
const IntrusivePtr<Val>& GetElementByID(const IntrusivePtr<ID>& id) const
const IntrusivePtr<Val>& GetElementByID(const IntrusivePtr<zeek::detail::ID>& id) const
{ return GetElementByID(id.get()); }
[[deprecated("Remove in v4.1. Use GetElementByID().")]]
Val* GetElement(const ID* id) const
Val* GetElement(const zeek::detail::ID* id) const
{ return GetElementByID(id).get(); }
/**
@ -247,7 +247,7 @@ private:
bool weak_ref;
};
const IntrusivePtr<Val>& GetElementByID(const ID* id) const;
const IntrusivePtr<Val>& GetElementByID(const zeek::detail::ID* id) const;
/**
* Sets the element at index *n* of the underlying array to *v*, but does
@ -273,7 +273,7 @@ private:
void ClearElement(int n);
/** Have we captured this id? */
bool IsOuterID(const ID* in) const;
bool IsOuterID(const zeek::detail::ID* in) const;
/** Serializes an offset_map */
static broker::expected<broker::data>

View file

@ -122,7 +122,7 @@ Func::Func(Kind arg_kind) : kind(arg_kind)
Func::~Func() = default;
void Func::AddBody(IntrusivePtr<zeek::detail::Stmt> /* new_body */,
const std::vector<IntrusivePtr<ID>>& /* new_inits */,
const std::vector<IntrusivePtr<zeek::detail::ID>>& /* new_inits */,
size_t /* new_frame_size */, int /* priority */)
{
Internal("Func::AddBody called");
@ -268,8 +268,8 @@ void Func::CheckPluginResult(bool handled, const IntrusivePtr<Val>& hook_result,
}
}
BroFunc::BroFunc(const IntrusivePtr<ID>& arg_id, IntrusivePtr<zeek::detail::Stmt> arg_body,
const std::vector<IntrusivePtr<ID>>& aggr_inits,
BroFunc::BroFunc(const IntrusivePtr<zeek::detail::ID>& arg_id, IntrusivePtr<zeek::detail::Stmt> arg_body,
const std::vector<IntrusivePtr<zeek::detail::ID>>& aggr_inits,
size_t arg_frame_size, int priority)
: Func(BRO_FUNC)
{
@ -450,7 +450,7 @@ IntrusivePtr<Val> BroFunc::Invoke(zeek::Args* args, Frame* parent) const
}
void BroFunc::AddBody(IntrusivePtr<zeek::detail::Stmt> new_body,
const std::vector<IntrusivePtr<ID>>& new_inits,
const std::vector<IntrusivePtr<zeek::detail::ID>>& new_inits,
size_t new_frame_size, int priority)
{
if ( new_frame_size > frame_size )
@ -575,7 +575,7 @@ void BroFunc::Describe(ODesc* d) const
}
IntrusivePtr<zeek::detail::Stmt> BroFunc::AddInits(IntrusivePtr<zeek::detail::Stmt> body,
const std::vector<IntrusivePtr<ID>>& inits)
const std::vector<IntrusivePtr<zeek::detail::ID>>& inits)
{
if ( inits.empty() )
return body;

View file

@ -22,11 +22,11 @@
class Val;
class FuncType;
class Frame;
class ID;
class Scope;
FORWARD_DECLARE_NAMESPACED(Stmt, zeek::detail);
FORWARD_DECLARE_NAMESPACED(CallExpr, zeek::detail);
FORWARD_DECLARE_NAMESPACED(ID, zeek::detail);
class Func : public BroObj {
public:
@ -79,7 +79,7 @@ public:
// Add a new event handler to an existing function (event).
virtual void AddBody(IntrusivePtr<zeek::detail::Stmt> new_body,
const std::vector<IntrusivePtr<ID>>& new_inits,
const std::vector<IntrusivePtr<zeek::detail::ID>>& new_inits,
size_t new_frame_size, int priority = 0);
virtual void SetScope(IntrusivePtr<Scope> newscope);
@ -129,8 +129,8 @@ protected:
class BroFunc final : public Func {
public:
BroFunc(const IntrusivePtr<ID>& id, IntrusivePtr<zeek::detail::Stmt> body,
const std::vector<IntrusivePtr<ID>>& inits,
BroFunc(const IntrusivePtr<zeek::detail::ID>& id, IntrusivePtr<zeek::detail::Stmt> body,
const std::vector<IntrusivePtr<zeek::detail::ID>>& inits,
size_t frame_size, int priority);
~BroFunc() override;
@ -168,7 +168,7 @@ public:
broker::expected<broker::data> SerializeClosure() const;
void AddBody(IntrusivePtr<zeek::detail::Stmt> new_body,
const std::vector<IntrusivePtr<ID>>& new_inits,
const std::vector<IntrusivePtr<zeek::detail::ID>>& new_inits,
size_t new_frame_size, int priority) override;
/** Sets this function's outer_id list. */
@ -179,8 +179,9 @@ public:
protected:
BroFunc() : Func(BRO_FUNC) {}
IntrusivePtr<zeek::detail::Stmt> AddInits(IntrusivePtr<zeek::detail::Stmt> body,
const std::vector<IntrusivePtr<ID>>& inits);
IntrusivePtr<zeek::detail::Stmt> AddInits(
IntrusivePtr<zeek::detail::Stmt> body,
const std::vector<IntrusivePtr<zeek::detail::ID>>& inits);
/**
* Clones this function along with its closures.
@ -269,9 +270,9 @@ struct function_ingredients {
// to build a function.
function_ingredients(IntrusivePtr<Scope> scope, IntrusivePtr<zeek::detail::Stmt> body);
IntrusivePtr<ID> id;
IntrusivePtr<zeek::detail::ID> id;
IntrusivePtr<zeek::detail::Stmt> body;
std::vector<IntrusivePtr<ID>> inits;
std::vector<IntrusivePtr<zeek::detail::ID>> inits;
int frame_size;
int priority;
IntrusivePtr<Scope> scope;

View file

@ -31,7 +31,7 @@ IntrusivePtr<TableType> zeek::id::count_set;
IntrusivePtr<VectorType> zeek::id::string_vec;
IntrusivePtr<VectorType> zeek::id::index_vec;
const IntrusivePtr<ID>& zeek::id::find(std::string_view name)
const IntrusivePtr<zeek::detail::ID>& zeek::id::find(std::string_view name)
{
return global_scope()->Find(name);
}
@ -102,6 +102,8 @@ void zeek::id::detail::init()
index_vec = zeek::id::find_type<VectorType>("index_vec");
}
namespace zeek::detail {
ID::ID(const char* arg_name, IDScope arg_scope, bool arg_is_export)
{
name = copy_string(arg_name);
@ -118,6 +120,9 @@ ID::ID(const char* arg_name, IDScope arg_scope, bool arg_is_export)
SetLocationInfo(&start_location, &end_location);
}
ID::ID(const char* arg_name, ::IDScope arg_scope, bool arg_is_export) :
ID(arg_name, static_cast<IDScope>(arg_scope), arg_is_export) {}
ID::~ID()
{
delete [] name;
@ -205,7 +210,7 @@ void ID::SetVal(IntrusivePtr<Val> v, init_class c)
}
}
void ID::SetVal(IntrusivePtr<zeek::detail::Expr> ev, init_class c)
void ID::SetVal(IntrusivePtr<Expr> ev, init_class c)
{
const auto& a = attrs->Find(c == INIT_EXTRA ? ATTR_ADD_FUNC : ATTR_DEL_FUNC);
@ -215,6 +220,16 @@ void ID::SetVal(IntrusivePtr<zeek::detail::Expr> ev, init_class c)
EvalFunc(a->GetExpr(), std::move(ev));
}
void ID::SetVal(IntrusivePtr<Val> v, ::init_class c)
{
SetVal(v, static_cast<init_class>(c));
}
void ID::SetVal(IntrusivePtr<Expr> ev, ::init_class c)
{
SetVal(ev, static_cast<init_class>(c));
}
bool ID::IsRedefinable() const
{
return GetAttr(ATTR_REDEF) != nullptr;
@ -276,7 +291,7 @@ bool ID::IsDeprecated() const
return GetAttr(ATTR_DEPRECATED) != nullptr;
}
void ID::MakeDeprecated(IntrusivePtr<zeek::detail::Expr> deprecation)
void ID::MakeDeprecated(IntrusivePtr<Expr> deprecation)
{
if ( IsDeprecated() )
return;
@ -337,13 +352,13 @@ void ID::SetOption()
}
}
void ID::EvalFunc(IntrusivePtr<zeek::detail::Expr> ef, IntrusivePtr<zeek::detail::Expr> ev)
void ID::EvalFunc(IntrusivePtr<Expr> ef, IntrusivePtr<Expr> ev)
{
auto arg1 = make_intrusive<zeek::detail::ConstExpr>(val);
auto args = make_intrusive<zeek::detail::ListExpr>();
args->Append(std::move(arg1));
args->Append(std::move(ev));
auto ce = make_intrusive<zeek::detail::CallExpr>(std::move(ef), std::move(args));
auto ce = make_intrusive<CallExpr>(std::move(ef), std::move(args));
SetVal(ce->Eval(nullptr));
}
@ -655,3 +670,5 @@ std::vector<Func*> ID::GetOptionHandlers() const
v.push_back(element.second.get());
return v;
}
}

View file

@ -22,16 +22,25 @@ class VectorType;
class EnumType;
class Attributes;
FORWARD_DECLARE_NAMESPACED(Expr, zeek::detail);
enum [[deprecated("Remove in v4.1. Use zeek::detail::init_class instead.")]] init_class { INIT_NONE, INIT_FULL, INIT_EXTRA, INIT_REMOVE, };
enum [[deprecated("Remove in v4.1. Use zeek::detail::IDScope instead.")]] IDScope { SCOPE_FUNCTION, SCOPE_MODULE, SCOPE_GLOBAL };
typedef enum { INIT_NONE, INIT_FULL, INIT_EXTRA, INIT_REMOVE, } init_class;
typedef enum { SCOPE_FUNCTION, SCOPE_MODULE, SCOPE_GLOBAL } IDScope;
namespace zeek::detail {
class Expr;
enum init_class { INIT_NONE, INIT_FULL, INIT_EXTRA, INIT_REMOVE, };
enum IDScope { SCOPE_FUNCTION, SCOPE_MODULE, SCOPE_GLOBAL };
class ID final : public BroObj, public notifier::Modifiable {
public:
static inline const IntrusivePtr<ID> nil;
ID(const char* name, IDScope arg_scope, bool arg_is_export);
[[deprecated("Remove in v4.1. Use version that takes zeek::detail::IDScope")]]
ID(const char* name, ::IDScope arg_scope, bool arg_is_export);
~ID() override;
const char* Name() const { return name; }
@ -71,7 +80,12 @@ public:
void SetVal(IntrusivePtr<Val> v);
void SetVal(IntrusivePtr<Val> v, init_class c);
void SetVal(IntrusivePtr<zeek::detail::Expr> ev, init_class c);
void SetVal(IntrusivePtr<Expr> ev, init_class c);
[[deprecated("Remove in v4.1. Use version that takes zeek::detail::init_class")]]
void SetVal(IntrusivePtr<Val> v, ::init_class c);
[[deprecated("Remove in v4.1. Use version that takes zeek::detail::init_class")]]
void SetVal(IntrusivePtr<Expr> ev, ::init_class c);
bool HasVal() const { return val != nullptr; }
@ -118,7 +132,7 @@ public:
bool IsDeprecated() const;
void MakeDeprecated(IntrusivePtr<zeek::detail::Expr> deprecation);
void MakeDeprecated(IntrusivePtr<Expr> deprecation);
std::string GetDeprecationWarning() const;
@ -145,7 +159,7 @@ public:
std::vector<Func*> GetOptionHandlers() const;
protected:
void EvalFunc(IntrusivePtr<zeek::detail::Expr> ef, IntrusivePtr<zeek::detail::Expr> ev);
void EvalFunc(IntrusivePtr<Expr> ef, IntrusivePtr<Expr> ev);
#ifdef DEBUG
void UpdateValID();
@ -165,6 +179,10 @@ protected:
};
}
using ID [[deprecated("Remove in v4.1. Use zeek::detail::ID instead.")]] = zeek::detail::ID;
namespace zeek::id {
/**
@ -173,7 +191,7 @@ namespace zeek::id {
* @return The identifier, which may reference a nil object if no such
* name exists.
*/
const IntrusivePtr<ID>& find(std::string_view name);
const IntrusivePtr<zeek::detail::ID>& find(std::string_view name);
/**
* Lookup an ID by its name and return its type. A fatal occurs if the ID

View file

@ -2,11 +2,13 @@
#include <stdint.h> // for u_char
#include <sys/types.h> // for u_char
#include "util.h"
class ID;
class Rule;
class RuleEndpointState;
FORWARD_DECLARE_NAMESPACED(ID, zeek::detail);
// Base class for all rule conditions except patterns and "header".
class RuleCondition {
public:
@ -111,7 +113,5 @@ public:
void PrintDebug() override;
private:
ID* id;
zeek::detail::ID* id;
};

View file

@ -15,7 +15,7 @@ typedef PList<Scope> scope_list;
static scope_list scopes;
static Scope* top_scope;
Scope::Scope(IntrusivePtr<ID> id,
Scope::Scope(IntrusivePtr<zeek::detail::ID> id,
std::unique_ptr<std::vector<IntrusivePtr<Attr>>> al)
: scope_id(std::move(id)), attrs(std::move(al))
{
@ -35,17 +35,17 @@ Scope::Scope(IntrusivePtr<ID> id,
}
}
const IntrusivePtr<ID>& Scope::Find(std::string_view name) const
const IntrusivePtr<zeek::detail::ID>& Scope::Find(std::string_view name) const
{
auto entry = local.find(name);
if ( entry != local.end() )
return entry->second;
return ID::nil;
return zeek::detail::ID::nil;
}
IntrusivePtr<ID> Scope::Remove(std::string_view name)
IntrusivePtr<zeek::detail::ID> Scope::Remove(std::string_view name)
{
auto entry = local.find(name);
@ -59,12 +59,12 @@ IntrusivePtr<ID> Scope::Remove(std::string_view name)
return nullptr;
}
IntrusivePtr<ID> Scope::GenerateTemporary(const char* name)
IntrusivePtr<zeek::detail::ID> Scope::GenerateTemporary(const char* name)
{
return make_intrusive<ID>(name, SCOPE_FUNCTION, false);
return make_intrusive<zeek::detail::ID>(name, zeek::detail::SCOPE_FUNCTION, false);
}
std::vector<IntrusivePtr<ID>> Scope::GetInits()
std::vector<IntrusivePtr<zeek::detail::ID>> Scope::GetInits()
{
auto rval = std::move(inits);
inits = {};
@ -100,7 +100,7 @@ void Scope::Describe(ODesc* d) const
for ( const auto& entry : local )
{
ID* id = entry.second.get();
zeek::detail::ID* id = entry.second.get();
id->Describe(d);
d->NL();
}
@ -110,7 +110,7 @@ TraversalCode Scope::Traverse(TraversalCallback* cb) const
{
for ( const auto& entry : local )
{
ID* id = entry.second.get();
zeek::detail::ID* id = entry.second.get();
TraversalCode tc = id->Traverse(cb);
HANDLE_TC_STMT_PRE(tc);
}
@ -119,9 +119,9 @@ TraversalCode Scope::Traverse(TraversalCallback* cb) const
}
const IntrusivePtr<ID>& lookup_ID(const char* name, const char* curr_module,
bool no_global, bool same_module_only,
bool check_export)
const 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);
@ -150,30 +150,30 @@ const IntrusivePtr<ID>& lookup_ID(const char* name, const char* curr_module,
return global_scope()->Find(globalname);
}
return ID::nil;
return zeek::detail::ID::nil;
}
IntrusivePtr<ID> install_ID(const char* name, const char* module_name,
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");
IDScope scope;
zeek::detail::IDScope scope;
if ( is_export || ! module_name ||
(is_global &&
normalized_module_name(module_name) == GLOBAL_MODULE_NAME) )
scope = SCOPE_GLOBAL;
scope = zeek::detail::SCOPE_GLOBAL;
else if ( is_global )
scope = SCOPE_MODULE;
scope = zeek::detail::SCOPE_MODULE;
else
scope = SCOPE_FUNCTION;
scope = zeek::detail::SCOPE_FUNCTION;
std::string full_name = make_full_var_name(module_name, name);
auto id = make_intrusive<ID>(full_name.data(), scope, is_export);
auto id = make_intrusive<zeek::detail::ID>(full_name.data(), scope, is_export);
if ( SCOPE_FUNCTION != scope )
if ( zeek::detail::SCOPE_FUNCTION != scope )
global_scope()->Insert(std::move(full_name), id);
else
{
@ -189,7 +189,7 @@ void push_existing_scope(Scope* scope)
scopes.push_back(scope);
}
void push_scope(IntrusivePtr<ID> id,
void push_scope(IntrusivePtr<zeek::detail::ID> id,
std::unique_ptr<std::vector<IntrusivePtr<Attr>>> attrs)
{
top_scope = new Scope(std::move(id), std::move(attrs));

View file

@ -13,31 +13,32 @@
#include "TraverseTypes.h"
template <class T> class IntrusivePtr;
class ID;
class BroType;
class ListVal;
FORWARD_DECLARE_NAMESPACED(ID, zeek::detail);
class Scope : public BroObj {
public:
explicit Scope(IntrusivePtr<ID> id,
explicit Scope(IntrusivePtr<zeek::detail::ID> id,
std::unique_ptr<std::vector<IntrusivePtr<Attr>>> al);
const IntrusivePtr<ID>& Find(std::string_view name) const;
const IntrusivePtr<zeek::detail::ID>& Find(std::string_view name) const;
template<typename N>
[[deprecated("Remove in v4.1. Use Find().")]]
ID* Lookup(N&& name) const
zeek::detail::ID* Lookup(N&& name) const
{ return Find(name).get(); }
template<typename N, typename I>
void Insert(N&& name, I&& id) { local[std::forward<N>(name)] = std::forward<I>(id); }
IntrusivePtr<ID> Remove(std::string_view name);
IntrusivePtr<zeek::detail::ID> Remove(std::string_view name);
[[deprecated("Remove in v4.1. Use GetID().")]]
ID* ScopeID() const { return scope_id.get(); }
zeek::detail::ID* ScopeID() const { return scope_id.get(); }
const IntrusivePtr<ID>& GetID() const
const IntrusivePtr<zeek::detail::ID>& GetID() const
{ return scope_id; }
const std::unique_ptr<std::vector<IntrusivePtr<Attr>>>& Attrs() const
@ -52,14 +53,14 @@ public:
size_t Length() const { return local.size(); }
const auto& Vars() { return local; }
IntrusivePtr<ID> GenerateTemporary(const char* name);
IntrusivePtr<zeek::detail::ID> GenerateTemporary(const char* name);
// Returns the list of variables needing initialization, and
// removes it from this Scope.
std::vector<IntrusivePtr<ID>> GetInits();
std::vector<IntrusivePtr<zeek::detail::ID>> GetInits();
// Adds a variable to the list.
void AddInit(IntrusivePtr<ID> id)
void AddInit(IntrusivePtr<zeek::detail::ID> id)
{ inits.emplace_back(std::move(id)); }
void Describe(ODesc* d) const override;
@ -67,26 +68,26 @@ public:
TraversalCode Traverse(TraversalCallback* cb) const;
protected:
IntrusivePtr<ID> scope_id;
IntrusivePtr<zeek::detail::ID> scope_id;
std::unique_ptr<std::vector<IntrusivePtr<Attr>>> attrs;
IntrusivePtr<BroType> return_type;
std::map<std::string, IntrusivePtr<ID>, std::less<>> local;
std::vector<IntrusivePtr<ID>> inits;
std::map<std::string, IntrusivePtr<zeek::detail::ID>, std::less<>> local;
std::vector<IntrusivePtr<zeek::detail::ID>> inits;
};
extern bool in_debug;
// If no_global is true, don't search in the default "global" namespace.
extern const IntrusivePtr<ID>& lookup_ID(const char* name, const char* module,
bool no_global = false,
bool same_module_only = false,
bool check_export = true);
extern const IntrusivePtr<zeek::detail::ID>& lookup_ID(const char* name, const char* module,
bool no_global = false,
bool same_module_only = false,
bool check_export = true);
extern IntrusivePtr<ID> install_ID(const char* name, const char* module_name,
bool is_global, bool is_export);
extern IntrusivePtr<zeek::detail::ID> install_ID(const char* name, const char* module_name,
bool is_global, bool is_export);
extern void push_scope(IntrusivePtr<ID> id,
extern void push_scope(IntrusivePtr<zeek::detail::ID> id,
std::unique_ptr<std::vector<IntrusivePtr<Attr>>> attrs);
extern void push_existing_scope(Scope* scope);

View file

@ -252,7 +252,7 @@ void ProfileLogger::Log()
for ( const auto& global : globals )
{
ID* id = global.second.get();
auto id = global.second;
// We don't show/count internal globals as they are always
// contained in some other global user-visible container.

View file

@ -6,10 +6,10 @@
class Func;
class Scope;
class ID;
FORWARD_DECLARE_NAMESPACED(Stmt, zeek::detail);
FORWARD_DECLARE_NAMESPACED(Expr, zeek::detail);
FORWARD_DECLARE_NAMESPACED(ID, zeek::detail);
class TraversalCallback {
public:
@ -25,14 +25,14 @@ public:
virtual TraversalCode PreExpr(const zeek::detail::Expr*) { return TC_CONTINUE; }
virtual TraversalCode PostExpr(const zeek::detail::Expr*) { return TC_CONTINUE; }
virtual TraversalCode PreID(const ID*) { return TC_CONTINUE; }
virtual TraversalCode PostID(const ID*) { return TC_CONTINUE; }
virtual TraversalCode PreID(const zeek::detail::ID*) { return TC_CONTINUE; }
virtual TraversalCode PostID(const zeek::detail::ID*) { return TC_CONTINUE; }
virtual TraversalCode PreTypedef(const ID*) { return TC_CONTINUE; }
virtual TraversalCode PostTypedef(const ID*) { return TC_CONTINUE; }
virtual TraversalCode PreTypedef(const zeek::detail::ID*) { return TC_CONTINUE; }
virtual TraversalCode PostTypedef(const zeek::detail::ID*) { return TC_CONTINUE; }
virtual TraversalCode PreDecl(const ID*) { return TC_CONTINUE; }
virtual TraversalCode PostDecl(const ID*) { return TC_CONTINUE; }
virtual TraversalCode PreDecl(const zeek::detail::ID*) { return TC_CONTINUE; }
virtual TraversalCode PostDecl(const zeek::detail::ID*) { return TC_CONTINUE; }
Scope* current_scope;
};

View file

@ -391,7 +391,7 @@ void Trigger::Timeout()
Unref(this);
}
void Trigger::Register(ID* id)
void Trigger::Register(zeek::detail::ID* id)
{
assert(! disabled);
notifier::registry.Register(id, this);

View file

@ -11,12 +11,12 @@
class Frame;
class Val;
class ID;
class ODesc;
FORWARD_DECLARE_NAMESPACED(Stmt, zeek::detail);
FORWARD_DECLARE_NAMESPACED(Expr, zeek::detail);
FORWARD_DECLARE_NAMESPACED(CallExpr, zeek::detail);
FORWARD_DECLARE_NAMESPACED(ID, zeek::detail);
namespace trigger {
// Triggers are the heart of "when" statements: expressions that when
@ -89,7 +89,7 @@ private:
friend class TriggerTimer;
void Init();
void Register(ID* id);
void Register(zeek::detail::ID* id);
void Register(Val* val);
void UnregisterAll();

View file

@ -379,12 +379,12 @@ void Val::ValDescribeReST(ODesc* d) const
#ifdef DEBUG
ID* Val::GetID() const
zeek::detail::ID* Val::GetID() const
{
return bound_id ? global_scope()->Find(bound_id).get() : nullptr;
}
void Val::SetID(ID* id)
void Val::SetID(zeek::detail::ID* id)
{
delete [] bound_id;
bound_id = id ? copy_string(id->Name()) : nullptr;

View file

@ -324,9 +324,9 @@ public:
#ifdef DEBUG
// For debugging, we keep a reference to the global ID to which a
// value has been bound *last*.
ID* GetID() const;
zeek::detail::ID* GetID() const;
void SetID(ID* id);
void SetID(zeek::detail::ID* id);
#endif
static bool WouldOverflow(const BroType* from_type, const BroType* to_type, const Val* val);

View file

@ -30,7 +30,7 @@ static IntrusivePtr<Val> init_val(zeek::detail::Expr* init, const BroType* t,
}
}
static bool add_prototype(const IntrusivePtr<ID>& id, BroType* t,
static bool add_prototype(const IntrusivePtr<zeek::detail::ID>& id, BroType* t,
std::vector<IntrusivePtr<Attr>>* attrs,
const IntrusivePtr<zeek::detail::Expr>& init)
{
@ -108,7 +108,8 @@ static bool add_prototype(const IntrusivePtr<ID>& id, BroType* t,
return true;
}
static void make_var(const IntrusivePtr<ID>& id, IntrusivePtr<BroType> t, init_class c,
static void make_var(const IntrusivePtr<zeek::detail::ID>& id, IntrusivePtr<BroType> t,
zeek::detail::init_class c,
IntrusivePtr<zeek::detail::Expr> init,
std::unique_ptr<std::vector<IntrusivePtr<Attr>>> attr,
decl_type dt,
@ -227,14 +228,14 @@ static void make_var(const IntrusivePtr<ID>& id, IntrusivePtr<BroType> t, init_c
if ( do_init )
{
if ( c == INIT_NONE && dt == VAR_REDEF && t->IsTable() &&
if ( c == zeek::detail::INIT_NONE && dt == VAR_REDEF && t->IsTable() &&
init && init->Tag() == zeek::detail::EXPR_ASSIGN )
// e.g. 'redef foo["x"] = 1' is missing an init class, but the
// intention clearly isn't to overwrite entire existing table val.
c = INIT_EXTRA;
c = zeek::detail::INIT_EXTRA;
if ( init && ((c == INIT_EXTRA && id->GetAttr(ATTR_ADD_FUNC)) ||
(c == INIT_REMOVE && id->GetAttr(ATTR_DEL_FUNC)) ))
if ( init && ((c == zeek::detail::INIT_EXTRA && id->GetAttr(ATTR_ADD_FUNC)) ||
(c == zeek::detail::INIT_REMOVE && id->GetAttr(ATTR_DEL_FUNC)) ))
// Just apply the function.
id->SetVal(init, c);
@ -301,22 +302,22 @@ static void make_var(const IntrusivePtr<ID>& id, IntrusivePtr<BroType> t, init_c
// For events, add a function value (without any body) here so that
// we can later access the ID even if no implementations have been
// defined.
std::vector<IntrusivePtr<ID>> inits;
std::vector<IntrusivePtr<zeek::detail::ID>> inits;
auto f = make_intrusive<BroFunc>(id, nullptr, inits, 0, 0);
id->SetVal(make_intrusive<Val>(std::move(f)));
}
}
void add_global(const IntrusivePtr<ID>& id, IntrusivePtr<BroType> t,
init_class c, IntrusivePtr<zeek::detail::Expr> init,
void add_global(const IntrusivePtr<zeek::detail::ID>& id, IntrusivePtr<BroType> t,
zeek::detail::init_class c, IntrusivePtr<zeek::detail::Expr> init,
std::unique_ptr<std::vector<IntrusivePtr<Attr>>> attr,
decl_type dt)
{
make_var(id, std::move(t), c, std::move(init), std::move(attr), dt, true);
}
IntrusivePtr<zeek::detail::Stmt> add_local(IntrusivePtr<ID> id, IntrusivePtr<BroType> t,
init_class c, IntrusivePtr<zeek::detail::Expr> init,
IntrusivePtr<zeek::detail::Stmt> add_local(IntrusivePtr<zeek::detail::ID> id, IntrusivePtr<BroType> t,
zeek::detail::init_class c, IntrusivePtr<zeek::detail::Expr> init,
std::unique_ptr<std::vector<IntrusivePtr<Attr>>> attr,
decl_type dt)
{
@ -324,7 +325,7 @@ IntrusivePtr<zeek::detail::Stmt> add_local(IntrusivePtr<ID> id, IntrusivePtr<Bro
if ( init )
{
if ( c != INIT_FULL )
if ( c != zeek::detail::INIT_FULL )
id->Error("can't use += / -= for initializations of local variables");
// copy Location to the stack, because AssignExpr may free "init"
@ -347,17 +348,17 @@ IntrusivePtr<zeek::detail::Stmt> add_local(IntrusivePtr<ID> id, IntrusivePtr<Bro
}
}
extern IntrusivePtr<zeek::detail::Expr> add_and_assign_local(IntrusivePtr<ID> id,
extern IntrusivePtr<zeek::detail::Expr> add_and_assign_local(IntrusivePtr<zeek::detail::ID> id,
IntrusivePtr<zeek::detail::Expr> init,
IntrusivePtr<Val> val)
{
make_var(id, nullptr, INIT_FULL, init, nullptr, VAR_REGULAR, false);
make_var(id, nullptr, zeek::detail::INIT_FULL, init, nullptr, VAR_REGULAR, false);
auto name_expr = make_intrusive<zeek::detail::NameExpr>(std::move(id));
return make_intrusive<zeek::detail::AssignExpr>(std::move(name_expr), std::move(init),
false, std::move(val));
}
void add_type(ID* id, IntrusivePtr<BroType> t,
void add_type(zeek::detail::ID* id, IntrusivePtr<BroType> t,
std::unique_ptr<std::vector<IntrusivePtr<Attr>>> attr)
{
std::string new_type_name = id->Name();
@ -458,7 +459,7 @@ static bool canonical_arg_types_match(const FuncType* decl, const FuncType* impl
return true;
}
void begin_func(IntrusivePtr<ID> id, const char* module_name,
void begin_func(IntrusivePtr<zeek::detail::ID> id, const char* module_name,
function_flavor flavor, bool is_redef,
IntrusivePtr<FuncType> t,
std::unique_ptr<std::vector<IntrusivePtr<Attr>>> attrs)

View file

@ -18,28 +18,28 @@ FORWARD_DECLARE_NAMESPACED(Expr, zeek::detail);
typedef enum { VAR_REGULAR, VAR_CONST, VAR_REDEF, VAR_OPTION, } decl_type;
extern void add_global(const IntrusivePtr<ID>& id,
extern void add_global(const IntrusivePtr<zeek::detail::ID>& id,
IntrusivePtr<BroType> t,
init_class c,
zeek::detail::init_class c,
IntrusivePtr<zeek::detail::Expr> init,
std::unique_ptr<std::vector<IntrusivePtr<Attr>>> attr,
decl_type dt);
extern IntrusivePtr<zeek::detail::Stmt> add_local(IntrusivePtr<ID> id,
extern IntrusivePtr<zeek::detail::Stmt> add_local(IntrusivePtr<zeek::detail::ID> id,
IntrusivePtr<BroType> t,
init_class c,
zeek::detail::init_class c,
IntrusivePtr<zeek::detail::Expr> init,
std::unique_ptr<std::vector<IntrusivePtr<Attr>>> attr,
decl_type dt);
extern IntrusivePtr<zeek::detail::Expr> add_and_assign_local(IntrusivePtr<ID> id,
extern IntrusivePtr<zeek::detail::Expr> add_and_assign_local(IntrusivePtr<zeek::detail::ID> id,
IntrusivePtr<zeek::detail::Expr> init,
IntrusivePtr<Val> val = nullptr);
extern void add_type(ID* id, IntrusivePtr<BroType> t,
extern void add_type(zeek::detail::ID* id, IntrusivePtr<BroType> t,
std::unique_ptr<std::vector<IntrusivePtr<Attr>>> attr);
extern void begin_func(IntrusivePtr<ID> id, const char* module_name,
extern void begin_func(IntrusivePtr<zeek::detail::ID> id, const char* module_name,
function_flavor flavor, bool is_redef,
IntrusivePtr<FuncType> t,
std::unique_ptr<std::vector<IntrusivePtr<Attr>>> attrs = nullptr);

View file

@ -31,7 +31,7 @@ Config::Config(ReaderFrontend *frontend) : ReaderBackend(frontend)
for ( const auto& entry : globals )
{
ID* id = entry.second.get();
auto id = entry.second;
if ( ! id->IsOption() )
continue;

View file

@ -7,7 +7,7 @@ module Option;
#include "NetVar.h"
#include "broker/Data.h"
static bool call_option_handlers_and_set_value(StringVal* name, const IntrusivePtr<ID>& i,
static bool call_option_handlers_and_set_value(StringVal* name, const IntrusivePtr<zeek::detail::ID>& i,
IntrusivePtr<Val> val,
StringVal* location)
{

View file

@ -136,7 +136,7 @@ std::vector<int> saved_in_init;
static Location func_hdr_location;
EnumType *cur_enum_type = 0;
static ID* cur_decl_type_id = 0;
static zeek::detail::ID* cur_decl_type_id = 0;
static void parser_new_enum (void)
{
@ -149,7 +149,7 @@ static void parser_new_enum (void)
reporter->FatalError("incorrect syntax for enum type declaration");
}
static void parser_redef_enum (ID *id)
static void parser_redef_enum (zeek::detail::ID *id)
{
/* Redef an enum. id points to the enum to be redefined.
Let cur_enum_type point to it. */
@ -166,7 +166,7 @@ static void parser_redef_enum (ID *id)
}
}
static void extend_record(ID* id, std::unique_ptr<type_decl_list> fields,
static void extend_record(zeek::detail::ID* id, std::unique_ptr<type_decl_list> fields,
std::unique_ptr<std::vector<IntrusivePtr<Attr>>> attrs)
{
std::set<BroType*> types = BroType::GetAliases(id->Name());
@ -232,9 +232,9 @@ static bool expr_is_table_type_name(const zeek::detail::Expr* expr)
%union {
bool b;
char* str;
ID* id;
zeek::detail::ID* id;
id_list* id_l;
init_class ic;
zeek::detail::init_class ic;
Val* val;
RE_Matcher* re;
zeek::detail::Expr* expr;
@ -1295,10 +1295,10 @@ opt_type:
;
init_class:
{ $$ = INIT_NONE; }
| '=' { $$ = INIT_FULL; }
| TOK_ADD_TO { $$ = INIT_EXTRA; }
| TOK_REMOVE_FROM { $$ = INIT_REMOVE; }
{ $$ = zeek::detail::INIT_NONE; }
| '=' { $$ = zeek::detail::INIT_FULL; }
| TOK_ADD_TO { $$ = zeek::detail::INIT_EXTRA; }
| TOK_REMOVE_FROM { $$ = zeek::detail::INIT_REMOVE; }
;
opt_init:
@ -1658,7 +1658,7 @@ case_type_list:
case_type:
TOK_TYPE type
{
$$ = new ID(0, SCOPE_FUNCTION, 0);
$$ = new zeek::detail::ID(0, zeek::detail::SCOPE_FUNCTION, 0);
$$->SetType({AdoptRef{}, $2});
}
@ -1673,7 +1673,7 @@ case_type:
else
case_var = install_ID(name, current_module.c_str(), false, false);
add_local(case_var, std::move(type), INIT_NONE, nullptr, nullptr,
add_local(case_var, std::move(type), zeek::detail::INIT_NONE, nullptr, nullptr,
VAR_REGULAR);
$$ = case_var.release();
}

View file

@ -1918,7 +1918,7 @@ function global_sizes%(%): var_sizes
for ( const auto& global : globals )
{
ID* id = global.second.get();
auto id = global.second;
if ( id->HasVal() )
{
auto id_name = make_intrusive<StringVal>(id->Name());
@ -1946,7 +1946,7 @@ function global_ids%(%): id_table
for ( const auto& global : globals )
{
ID* id = global.second.get();
zeek::detail::ID* id = global.second.get();
static auto script_id = zeek::id::find_type<RecordType>("script_id");
auto rec = make_intrusive<RecordVal>(script_id);
rec->Assign(0, make_intrusive<StringVal>(type_name(id->GetType()->Tag())));

View file

@ -11,7 +11,7 @@
using namespace std;
using namespace zeekygen;
IdentifierInfo::IdentifierInfo(IntrusivePtr<ID> arg_id, ScriptInfo* script)
IdentifierInfo::IdentifierInfo(IntrusivePtr<zeek::detail::ID> arg_id, ScriptInfo* script)
: Info(),
comments(), id(std::move(arg_id)), initial_val(), redefs(), fields(),
last_field_seen(), declaring_script(script)
@ -31,7 +31,7 @@ IdentifierInfo::~IdentifierInfo()
delete it->second;
}
void IdentifierInfo::AddRedef(const string& script, init_class ic,
void IdentifierInfo::AddRedef(const string& script, zeek::detail::init_class ic,
IntrusivePtr<zeek::detail::Expr> init_expr, const vector<string>& comments)
{
Redefinition* redef = new Redefinition(script, ic, std::move(init_expr), comments);
@ -141,7 +141,7 @@ time_t IdentifierInfo::DoGetModificationTime() const
IdentifierInfo::Redefinition::Redefinition(
std::string arg_script,
init_class arg_ic,
zeek::detail::init_class arg_ic,
IntrusivePtr<zeek::detail::Expr> arg_expr,
std::vector<std::string> arg_comments)
: from_script(std::move(arg_script)),

View file

@ -32,7 +32,7 @@ public:
* @param script The info object associated with the script in which \a id
* is declared.
*/
IdentifierInfo(IntrusivePtr<ID> id, ScriptInfo* script);
IdentifierInfo(IntrusivePtr<zeek::detail::ID> id, ScriptInfo* script);
/**
* Dtor. Releases any references to script-level objects.
@ -70,7 +70,7 @@ public:
* @param init_expr The initialization expression used.
* @param comments Comments associated with the redef statement.
*/
void AddRedef(const std::string& from_script, init_class ic,
void AddRedef(const std::string& from_script, zeek::detail::init_class ic,
IntrusivePtr<zeek::detail::Expr> init_expr,
const std::vector<std::string>& comments);
@ -96,7 +96,7 @@ public:
/**
* @return the script-level ID tracked by this info object.
*/
ID* GetID() const
zeek::detail::ID* GetID() const
{ return id.get(); }
/**
@ -127,11 +127,11 @@ public:
*/
struct Redefinition {
std::string from_script; /**< Name of script doing the redef. */
init_class ic;
zeek::detail::init_class ic;
IntrusivePtr<zeek::detail::Expr> init_expr;
std::vector<std::string> comments; /**< Zeekygen comments on redef. */
Redefinition(std::string arg_script, init_class arg_ic,
Redefinition(std::string arg_script, zeek::detail::init_class arg_ic,
IntrusivePtr<zeek::detail::Expr> arg_expr,
std::vector<std::string> arg_comments);
@ -174,7 +174,7 @@ private:
typedef std::map<std::string, RecordField*> record_field_map;
std::vector<std::string> comments;
IntrusivePtr<ID> id;
IntrusivePtr<zeek::detail::ID> id;
IntrusivePtr<Val> initial_val;
redef_list redefs;
record_field_map fields;

View file

@ -27,7 +27,7 @@ static void DbgAndWarn(const char* msg)
DBG_LOG(DBG_ZEEKYGEN, "%s", msg);
}
static void WarnMissingScript(const char* type, const ID* id,
static void WarnMissingScript(const char* type, const zeek::detail::ID* id,
const string& script)
{
if ( script == "<command line>" )
@ -216,7 +216,7 @@ void Manager::ModuleUsage(const string& path, const string& module)
module.c_str(), name.c_str());
}
IdentifierInfo* Manager::CreateIdentifierInfo(IntrusivePtr<ID> id, ScriptInfo* script)
IdentifierInfo* Manager::CreateIdentifierInfo(IntrusivePtr<zeek::detail::ID> id, ScriptInfo* script)
{
const auto& id_name = id->Name();
auto prev = identifiers.GetInfo(id_name);
@ -247,7 +247,7 @@ IdentifierInfo* Manager::CreateIdentifierInfo(IntrusivePtr<ID> id, ScriptInfo* s
return rval;
}
void Manager::StartType(IntrusivePtr<ID> id)
void Manager::StartType(IntrusivePtr<zeek::detail::ID> id)
{
if ( disabled )
return;
@ -273,12 +273,12 @@ void Manager::StartType(IntrusivePtr<ID> id)
incomplete_type = CreateIdentifierInfo(std::move(id), script_info);
}
static bool IsEnumType(ID* id)
static bool IsEnumType(zeek::detail::ID* id)
{
return id->IsType() ? id->GetType()->Tag() == TYPE_ENUM : false;
}
void Manager::Identifier(IntrusivePtr<ID> id)
void Manager::Identifier(IntrusivePtr<zeek::detail::ID> id)
{
if ( disabled )
return;
@ -337,7 +337,7 @@ void Manager::Identifier(IntrusivePtr<ID> id)
CreateIdentifierInfo(std::move(id), script_info);
}
void Manager::RecordField(const ID* id, const TypeDecl* field,
void Manager::RecordField(const zeek::detail::ID* id, const TypeDecl* field,
const string& path)
{
if ( disabled )
@ -360,8 +360,8 @@ void Manager::RecordField(const ID* id, const TypeDecl* field,
field->id, id->Name(), script.c_str());
}
void Manager::Redef(const ID* id, const string& path,
init_class ic, IntrusivePtr<zeek::detail::Expr> init_expr)
void Manager::Redef(const zeek::detail::ID* id, const string& path,
zeek::detail::init_class ic, IntrusivePtr<zeek::detail::Expr> init_expr)
{
if ( disabled )
return;
@ -397,8 +397,8 @@ 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)
void Manager::Redef(const zeek::detail::ID* id, const std::string& path,
zeek::detail::init_class ic)
{
Redef(id, path, ic, nullptr);
}

View file

@ -110,14 +110,14 @@ public:
* Signal that a record or enum type is now being parsed.
* @param id The record or enum type identifier.
*/
void StartType(IntrusivePtr<ID> id);
void StartType(IntrusivePtr<zeek::detail::ID> id);
/**
* Register a script-level identifier for which information/documentation
* will be gathered.
* @param id The script-level identifier.
*/
void Identifier(IntrusivePtr<ID> id);
void Identifier(IntrusivePtr<zeek::detail::ID> id);
/**
* Register a record-field for which information/documentation will be
@ -128,7 +128,7 @@ public:
* declared. This can be different from the place where the record type
* is declared due to redefs.
*/
void RecordField(const ID* id, const TypeDecl* field,
void RecordField(const zeek::detail::ID* id, const TypeDecl* field,
const std::string& path);
/**
@ -138,10 +138,10 @@ public:
* @param ic The initialization class that was used (e.g. =, +=, -=).
* @param init_expr The intiialization expression that was used.
*/
void Redef(const ID* id, const std::string& path,
init_class ic, IntrusivePtr<zeek::detail::Expr> init_expr);
void Redef(const ID* id, const std::string& path,
init_class ic = INIT_NONE);
void Redef(const zeek::detail::ID* id, const std::string& path,
zeek::detail::init_class ic, IntrusivePtr<zeek::detail::Expr> init_expr);
void Redef(const zeek::detail::ID* id, const std::string& path,
zeek::detail::init_class ic = zeek::detail::INIT_NONE);
/**
* Register Zeekygen script summary content.
@ -217,7 +217,7 @@ private:
typedef std::vector<std::string> comment_buffer_t;
typedef std::map<std::string, comment_buffer_t> comment_buffer_map_t;
IdentifierInfo* CreateIdentifierInfo(IntrusivePtr<ID> id, ScriptInfo* script);
IdentifierInfo* CreateIdentifierInfo(IntrusivePtr<zeek::detail::ID> id, ScriptInfo* script);
bool disabled;
comment_buffer_t comment_buffer; // For whatever next identifier comes in.

View file

@ -82,7 +82,7 @@ static string make_summary(const string& heading, char underline, char border,
for ( id_info_list::const_iterator it = id_list.begin();
it != id_list.end(); ++it )
{
ID* id = (*it)->GetID();
auto* id = (*it)->GetID();
ODesc d;
d.SetQuotes(true);
id->DescribeReSTShort(&d);
@ -105,7 +105,7 @@ static string make_redef_summary(const string& heading, char underline,
for ( id_info_set::const_iterator it = id_set.begin(); it != id_set.end();
++it )
{
ID* id = (*it)->GetID();
auto* id = (*it)->GetID();
ODesc d;
d.SetQuotes(true);
id->DescribeReSTShort(&d);
@ -179,7 +179,7 @@ void ScriptInfo::DoInitPostScript()
it != id_info.end(); ++it )
{
IdentifierInfo* info = it->second;
ID* id = info->GetID();
auto* id = info->GetID();
if ( ! zeekygen::is_public_api(id) )
continue;

View file

@ -78,10 +78,10 @@ bool zeekygen::prettify_params(string& s)
return false;
}
bool zeekygen::is_public_api(const ID* id)
bool zeekygen::is_public_api(const zeek::detail::ID* id)
{
return (id->Scope() == SCOPE_GLOBAL) ||
(id->Scope() == SCOPE_MODULE && id->IsExport());
return (id->Scope() == zeek::detail::SCOPE_GLOBAL) ||
(id->Scope() == zeek::detail::SCOPE_MODULE && id->IsExport());
}
time_t zeekygen::get_mtime(const string& filename)

View file

@ -6,7 +6,8 @@
#include <time.h> // for time_t
class ID;
namespace zeek::detail { class ID; }
using ID [[deprecated("Remove in v4.1. Use zeek::detail::ID instead")]] = zeek::detail::ID;
namespace zeekygen {
@ -25,7 +26,7 @@ bool prettify_params(std::string& s);
* @return true if the ID is in the global scope or if it's exported in to
* any modules namespace.
*/
bool is_public_api(const ID* id);
bool is_public_api(const zeek::detail::ID* id);
/**
* Get the modification time of a file or abort if there's an error.