From 137e416a0314a0ce71d7df818eae9ba5baef651f Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Wed, 10 Jun 2020 14:27:36 -0700 Subject: [PATCH] Rename BroType to Type --- src/Attr.cc | 6 +- src/Attr.h | 8 +- src/BroList.h | 5 +- src/CompHash.cc | 8 +- src/CompHash.h | 6 +- src/Desc.cc | 6 +- src/Desc.h | 12 +- src/Expr.cc | 62 ++++----- src/Expr.h | 54 ++++---- src/File.h | 10 +- src/Frame.cc | 2 +- src/ID.cc | 4 +- src/ID.h | 20 +-- src/OpaqueVal.cc | 8 +- src/OpaqueVal.h | 16 +-- src/Scope.h | 9 +- src/Type.cc | 124 +++++++++--------- src/Type.h | 236 +++++++++++++++++------------------ src/Val.cc | 14 +-- src/Val.h | 28 ++--- src/Var.cc | 20 +-- src/Var.h | 8 +- src/broker/Data.cc | 16 +-- src/broker/Data.h | 8 +- src/broker/messaging.bif | 2 +- src/input/Manager.cc | 4 +- src/input/Manager.h | 4 +- src/logging/Manager.cc | 2 +- src/logging/Manager.h | 2 +- src/parse.y | 8 +- src/probabilistic/Topk.cc | 2 +- src/probabilistic/Topk.h | 4 +- src/threading/SerialTypes.cc | 6 +- src/threading/SerialTypes.h | 2 +- 34 files changed, 367 insertions(+), 359 deletions(-) diff --git a/src/Attr.cc b/src/Attr.cc index 913e84620d..dea614748c 100644 --- a/src/Attr.cc +++ b/src/Attr.cc @@ -146,7 +146,7 @@ void Attr::AddTag(ODesc* d) const d->Add(attr_name(Tag())); } -Attributes::Attributes(attr_list* a, IntrusivePtr t, bool arg_in_record, bool is_global) +Attributes::Attributes(attr_list* a, IntrusivePtr t, bool arg_in_record, bool is_global) { attrs.reserve(a->length()); in_record = arg_in_record; @@ -164,14 +164,14 @@ Attributes::Attributes(attr_list* a, IntrusivePtr t, bool arg_in_record delete a; } -Attributes::Attributes(IntrusivePtr t, +Attributes::Attributes(IntrusivePtr t, bool arg_in_record, bool is_global) : Attributes(std::vector>{}, std::move(t), arg_in_record, is_global) {} Attributes::Attributes(std::vector> a, - IntrusivePtr t, + IntrusivePtr t, bool arg_in_record, bool is_global) : type(std::move(t)) { diff --git a/src/Attr.h b/src/Attr.h index 828808b4b1..f51bb471a8 100644 --- a/src/Attr.h +++ b/src/Attr.h @@ -112,11 +112,11 @@ protected: class Attributes final : public BroObj { public: [[deprecated("Remove in v4.1. Construct using IntrusivePtrs instead.")]] - Attributes(attr_list* a, IntrusivePtr t, bool in_record, bool is_global); + Attributes(attr_list* a, IntrusivePtr t, bool in_record, bool is_global); - Attributes(std::vector> a, IntrusivePtr t, + Attributes(std::vector> a, IntrusivePtr t, bool in_record, bool is_global); - Attributes(IntrusivePtr t, bool in_record, bool is_global); + Attributes(IntrusivePtr t, bool in_record, bool is_global); void AddAttr(IntrusivePtr a); @@ -147,7 +147,7 @@ public: protected: void CheckAttr(Attr* attr); - IntrusivePtr type; + IntrusivePtr type; std::vector> attrs; bool in_record; bool global_var; diff --git a/src/BroList.h b/src/BroList.h index 0c971ad34a..c558be1641 100644 --- a/src/BroList.h +++ b/src/BroList.h @@ -16,8 +16,9 @@ using id_list = PList; FORWARD_DECLARE_NAMESPACED(Stmt, zeek::detail); using stmt_list = PList; -FORWARD_DECLARE_NAMESPACED(BroType, zeek); -using type_list = PList; +namespace zeek { class Type; } +using BroType [[deprecated("Remove in v4.1. Use zeek::Type instead.")]] = zeek::Type; +using type_list = PList; FORWARD_DECLARE_NAMESPACED(Attr, zeek::detail); using attr_list = PList; diff --git a/src/CompHash.cc b/src/CompHash.cc index 909494e91c..1e064491d1 100644 --- a/src/CompHash.cc +++ b/src/CompHash.cc @@ -71,7 +71,7 @@ CompositeHash::~CompositeHash() // Computes the piece of the hash for Val*, returning the new kp. char* CompositeHash::SingleValHash(bool type_check, char* kp0, - zeek::BroType* bt, Val* v, bool optional) const + zeek::Type* bt, Val* v, bool optional) const { char* kp1 = nullptr; zeek::InternalTypeTag t = bt->InternalType(); @@ -449,7 +449,7 @@ std::unique_ptr CompositeHash::ComputeSingletonHash(const Val* v, bool } } -int CompositeHash::SingleTypeKeySize(zeek::BroType* bt, const Val* v, +int CompositeHash::SingleTypeKeySize(zeek::Type* bt, const Val* v, bool type_check, int sz, bool optional, bool calc_static_size) const { @@ -730,7 +730,7 @@ IntrusivePtr CompositeHash::RecoverVals(const HashKey& k) const } const char* CompositeHash::RecoverOneVal(const HashKey& k, const char* kp0, - const char* const k_end, zeek::BroType* t, + const char* const k_end, zeek::Type* t, IntrusivePtr* pval, bool optional) const { // k->Size() == 0 for a single empty string. @@ -1010,7 +1010,7 @@ const char* CompositeHash::RecoverOneVal(const HashKey& k, const char* kp0, for ( int i = 0; i < n; ++i ) { IntrusivePtr v; - zeek::BroType* it = tl->Types()[i].get(); + zeek::Type* it = tl->Types()[i].get(); kp1 = RecoverOneVal(k, kp1, k_end, it, &v, false); lv->Append(std::move(v)); } diff --git a/src/CompHash.h b/src/CompHash.h index 38ccf735c8..367fd445a0 100644 --- a/src/CompHash.h +++ b/src/CompHash.h @@ -37,7 +37,7 @@ protected: // Computes the piece of the hash for Val*, returning the new kp. // Used as a helper for ComputeHash in the non-singleton case. - char* SingleValHash(bool type_check, char* kp, zeek::BroType* bt, Val* v, + char* SingleValHash(bool type_check, char* kp, zeek::Type* bt, Val* v, bool optional) const; // Recovers just one Val of possibly many; called from RecoverVals. @@ -46,7 +46,7 @@ protected: // upon errors, so there is no return value for invalid input. const char* RecoverOneVal(const HashKey& k, const char* kp, const char* const k_end, - zeek::BroType* t, IntrusivePtr* pval, bool optional) const; + zeek::Type* t, IntrusivePtr* pval, bool optional) const; // Rounds the given pointer up to the nearest multiple of the // given size, if not already a multiple. @@ -85,7 +85,7 @@ protected: int ComputeKeySize(const Val* v, bool type_check, bool calc_static_size) const; - int SingleTypeKeySize(zeek::BroType*, const Val*, + int SingleTypeKeySize(zeek::Type*, const Val*, bool type_check, int sz, bool optional, bool calc_static_size) const; diff --git a/src/Desc.cc b/src/Desc.cc index d2c67cb0dd..624aeaaa6b 100644 --- a/src/Desc.cc +++ b/src/Desc.cc @@ -403,19 +403,19 @@ void ODesc::Clear() } } -bool ODesc::PushType(const zeek::BroType* type) +bool ODesc::PushType(const zeek::Type* type) { auto res = encountered_types.insert(type); return std::get<1>(res); } -bool ODesc::PopType(const zeek::BroType* type) +bool ODesc::PopType(const zeek::Type* type) { size_t res = encountered_types.erase(type); return (res == 1); } -bool ODesc::FindType(const zeek::BroType* type) +bool ODesc::FindType(const zeek::Type* type) { auto res = encountered_types.find(type); diff --git a/src/Desc.h b/src/Desc.h index 3124ebfa16..7a009caa57 100644 --- a/src/Desc.h +++ b/src/Desc.h @@ -25,7 +25,9 @@ typedef enum { class BroFile; class IPAddr; class IPPrefix; -FORWARD_DECLARE_NAMESPACED(BroType, zeek); + +namespace zeek { class Type; } +using BroType [[deprecated("Remove in v4.1. Use zeek::Type instead.")]] = zeek::Type; class ODesc { public: @@ -146,9 +148,9 @@ public: // Used to determine recursive types. Records push their types on here; // if the same type (by address) is re-encountered, processing aborts. - bool PushType(const zeek::BroType* type); - bool PopType(const zeek::BroType* type); - bool FindType(const zeek::BroType* type); + bool PushType(const zeek::Type* type); + bool PopType(const zeek::Type* type); + bool FindType(const zeek::Type* type); protected: void Indent(); @@ -204,5 +206,5 @@ protected: bool do_flush; bool include_stats; - std::set encountered_types; + std::set encountered_types; }; diff --git a/src/Expr.cc b/src/Expr.cc index ae57cddbca..8f32196452 100644 --- a/src/Expr.cc +++ b/src/Expr.cc @@ -90,7 +90,7 @@ IntrusivePtr Expr::MakeLvalue() return {NewRef{}, this}; } -void Expr::EvalIntoAggregate(const BroType* /* t */, Val* /* aggr */, +void Expr::EvalIntoAggregate(const zeek::Type* /* t */, Val* /* aggr */, Frame* /* f */) const { Internal("Expr::EvalIntoAggregate called"); @@ -101,7 +101,7 @@ void Expr::Assign(Frame* /* f */, IntrusivePtr /* v */) Internal("Expr::Assign called"); } -IntrusivePtr Expr::InitType() const +IntrusivePtr Expr::InitType() const { return type; } @@ -116,7 +116,7 @@ bool Expr::IsPure() const return true; } -IntrusivePtr Expr::InitVal(const BroType* t, IntrusivePtr aggr) const +IntrusivePtr Expr::InitVal(const zeek::Type* t, IntrusivePtr aggr) const { if ( aggr ) { @@ -182,7 +182,7 @@ void Expr::Canonicize() { } -void Expr::SetType(IntrusivePtr t) +void Expr::SetType(IntrusivePtr t) { if ( ! type || type->Tag() != zeek::TYPE_ERROR ) type = std::move(t); @@ -1047,7 +1047,7 @@ PosExpr::PosExpr(IntrusivePtr arg_op) const auto& t = IsVector(op->GetType()->Tag()) ? op->GetType()->Yield() : op->GetType(); TypeTag bt = t->Tag(); - IntrusivePtr base_result_type; + IntrusivePtr base_result_type; if ( IsIntegral(bt) ) // Promote count and counter to int. @@ -1082,7 +1082,7 @@ NegExpr::NegExpr(IntrusivePtr arg_op) const auto& t = IsVector(op->GetType()->Tag()) ? op->GetType()->Yield() : op->GetType(); TypeTag bt = t->Tag(); - IntrusivePtr base_result_type; + IntrusivePtr base_result_type; if ( IsIntegral(bt) ) // Promote count and counter to int. @@ -1151,7 +1151,7 @@ AddExpr::AddExpr(IntrusivePtr arg_op1, IntrusivePtr arg_op2) if ( IsVector(bt2) ) bt2 = op2->GetType()->AsVectorType()->Yield()->Tag(); - IntrusivePtr base_result_type; + IntrusivePtr base_result_type; if ( bt2 == zeek::TYPE_INTERVAL && ( bt1 == zeek::TYPE_TIME || bt1 == zeek::TYPE_INTERVAL ) ) base_result_type = base_type(bt1); @@ -1276,7 +1276,7 @@ SubExpr::SubExpr(IntrusivePtr arg_op1, IntrusivePtr arg_op2) if ( IsVector(bt2) ) bt2 = t2->AsVectorType()->Yield()->Tag(); - IntrusivePtr base_result_type; + IntrusivePtr base_result_type; if ( bt2 == zeek::TYPE_INTERVAL && ( bt1 == zeek::TYPE_TIME || bt1 == zeek::TYPE_INTERVAL ) ) base_result_type = base_type(bt1); @@ -2262,7 +2262,7 @@ IntrusivePtr AssignExpr::Eval(Frame* f) const return nullptr; } -IntrusivePtr AssignExpr::InitType() const +IntrusivePtr AssignExpr::InitType() const { if ( op1->Tag() != EXPR_LIST ) { @@ -2278,7 +2278,7 @@ IntrusivePtr AssignExpr::InitType() const op2->GetType()); } -void AssignExpr::EvalIntoAggregate(const BroType* t, Val* aggr, Frame* f) const +void AssignExpr::EvalIntoAggregate(const zeek::Type* t, Val* aggr, Frame* f) const { if ( IsError() ) return; @@ -2327,7 +2327,7 @@ void AssignExpr::EvalIntoAggregate(const BroType* t, Val* aggr, Frame* f) const RuntimeError("type clash in table assignment"); } -IntrusivePtr AssignExpr::InitVal(const BroType* t, IntrusivePtr aggr) const +IntrusivePtr AssignExpr::InitVal(const zeek::Type* t, IntrusivePtr aggr) const { if ( ! aggr ) { @@ -3004,14 +3004,14 @@ RecordConstructorExpr::~RecordConstructorExpr() { } -IntrusivePtr RecordConstructorExpr::InitVal(const BroType* t, IntrusivePtr aggr) const +IntrusivePtr RecordConstructorExpr::InitVal(const zeek::Type* t, IntrusivePtr aggr) const { auto v = Eval(nullptr); if ( v ) { RecordVal* rv = v->AsRecordVal(); - auto bt = const_cast(t); + auto bt = const_cast(t); IntrusivePtr rt{NewRef{}, bt->AsRecordType()}; auto aggr_rec = cast_intrusive(std::move(aggr)); auto ar = rv->CoerceTo(std::move(rt), std::move(aggr_rec)); @@ -3049,7 +3049,7 @@ void RecordConstructorExpr::ExprDescribe(ODesc* d) const TableConstructorExpr::TableConstructorExpr(IntrusivePtr constructor_list, std::unique_ptr>> arg_attrs, - IntrusivePtr arg_type) + IntrusivePtr arg_type) : UnaryExpr(EXPR_TABLE_CONSTRUCTOR, std::move(constructor_list)) { if ( IsError() ) @@ -3143,7 +3143,7 @@ IntrusivePtr TableConstructorExpr::Eval(Frame* f) const return aggr; } -IntrusivePtr TableConstructorExpr::InitVal(const BroType* t, IntrusivePtr aggr) const +IntrusivePtr TableConstructorExpr::InitVal(const zeek::Type* t, IntrusivePtr aggr) const { if ( IsError() ) return nullptr; @@ -3170,7 +3170,7 @@ void TableConstructorExpr::ExprDescribe(ODesc* d) const SetConstructorExpr::SetConstructorExpr(IntrusivePtr constructor_list, std::unique_ptr>> arg_attrs, - IntrusivePtr arg_type) + IntrusivePtr arg_type) : UnaryExpr(EXPR_SET_CONSTRUCTOR, std::move(constructor_list)) { if ( IsError() ) @@ -3254,7 +3254,7 @@ IntrusivePtr SetConstructorExpr::Eval(Frame* f) const return aggr; } -IntrusivePtr SetConstructorExpr::InitVal(const BroType* t, IntrusivePtr aggr) const +IntrusivePtr SetConstructorExpr::InitVal(const zeek::Type* t, IntrusivePtr aggr) const { if ( IsError() ) return nullptr; @@ -3288,7 +3288,7 @@ void SetConstructorExpr::ExprDescribe(ODesc* d) const } VectorConstructorExpr::VectorConstructorExpr(IntrusivePtr constructor_list, - IntrusivePtr arg_type) + IntrusivePtr arg_type) : UnaryExpr(EXPR_VECTOR_CONSTRUCTOR, std::move(constructor_list)) { if ( IsError() ) @@ -3352,7 +3352,7 @@ IntrusivePtr VectorConstructorExpr::Eval(Frame* f) const return vec; } -IntrusivePtr VectorConstructorExpr::InitVal(const BroType* t, IntrusivePtr aggr) const +IntrusivePtr VectorConstructorExpr::InitVal(const zeek::Type* t, IntrusivePtr aggr) const { if ( IsError() ) return nullptr; @@ -3392,7 +3392,7 @@ FieldAssignExpr::FieldAssignExpr(const char* arg_field_name, SetType(op->GetType()); } -void FieldAssignExpr::EvalIntoAggregate(const BroType* t, Val* aggr, Frame* f) +void FieldAssignExpr::EvalIntoAggregate(const zeek::Type* t, Val* aggr, Frame* f) const { if ( IsError() ) @@ -3553,7 +3553,7 @@ RecordCoerceExpr::RecordCoerceExpr(IntrusivePtr arg_op, if ( ! same_type(sup_t_i, sub_t_i) ) { - auto is_arithmetic_promotable = [](BroType* sup, BroType* sub) -> bool + auto is_arithmetic_promotable = [](zeek::Type* sup, zeek::Type* sub) -> bool { auto sup_tag = sup->Tag(); auto sub_tag = sub->Tag(); @@ -3570,7 +3570,7 @@ RecordCoerceExpr::RecordCoerceExpr(IntrusivePtr arg_op, return true; }; - auto is_record_promotable = [](BroType* sup, BroType* sub) -> bool + auto is_record_promotable = [](zeek::Type* sup, zeek::Type* sub) -> bool { if ( sup->Tag() != zeek::TYPE_RECORD ) return false; @@ -3623,12 +3623,12 @@ RecordCoerceExpr::~RecordCoerceExpr() delete [] map; } -IntrusivePtr RecordCoerceExpr::InitVal(const BroType* t, IntrusivePtr aggr) const +IntrusivePtr RecordCoerceExpr::InitVal(const zeek::Type* t, IntrusivePtr aggr) const { if ( auto v = Eval(nullptr) ) { RecordVal* rv = v->AsRecordVal(); - auto bt = const_cast(t); + auto bt = const_cast(t); IntrusivePtr rt{NewRef{}, bt->AsRecordType()}; auto aggr_rec = cast_intrusive(std::move(aggr)); @@ -4399,7 +4399,7 @@ IntrusivePtr ListExpr::Eval(Frame* f) const return v; } -IntrusivePtr ListExpr::InitType() const +IntrusivePtr ListExpr::InitType() const { if ( exprs.empty() ) { @@ -4457,7 +4457,7 @@ IntrusivePtr ListExpr::InitType() const } } -IntrusivePtr ListExpr::InitVal(const BroType* t, IntrusivePtr aggr) const +IntrusivePtr ListExpr::InitVal(const zeek::Type* t, IntrusivePtr aggr) const { // While fairly similar to the EvalIntoAggregate() code, // we keep this separate since it also deals with initialization @@ -4601,7 +4601,7 @@ IntrusivePtr ListExpr::InitVal(const BroType* t, IntrusivePtr aggr) co return aggr; } -IntrusivePtr ListExpr::AddSetInit(const BroType* t, IntrusivePtr aggr) const +IntrusivePtr ListExpr::AddSetInit(const zeek::Type* t, IntrusivePtr aggr) const { if ( aggr->GetType()->Tag() != zeek::TYPE_TABLE ) Internal("bad aggregate in ListExpr::InitVal"); @@ -4764,7 +4764,7 @@ RecordAssignExpr::RecordAssignExpr(const IntrusivePtr& record, } } -CastExpr::CastExpr(IntrusivePtr arg_op, IntrusivePtr t) +CastExpr::CastExpr(IntrusivePtr arg_op, IntrusivePtr t) : UnaryExpr(EXPR_CAST, std::move(arg_op)) { auto stype = Op()->GetType(); @@ -4812,7 +4812,7 @@ void CastExpr::ExprDescribe(ODesc* d) const GetType()->Describe(d); } -IsExpr::IsExpr(IntrusivePtr arg_op, IntrusivePtr arg_t) +IsExpr::IsExpr(IntrusivePtr arg_op, IntrusivePtr arg_t) : UnaryExpr(EXPR_IS, std::move(arg_op)), t(std::move(arg_t)) { SetType(zeek::base_type(zeek::TYPE_BOOL)); @@ -4850,7 +4850,7 @@ IntrusivePtr get_assign_expr(IntrusivePtr op1, is_init); } -IntrusivePtr check_and_promote_expr(Expr* const e, BroType* t) +IntrusivePtr check_and_promote_expr(Expr* const e, zeek::Type* t) { const auto& et = e->GetType(); TypeTag e_tag = et->Tag(); @@ -5006,7 +5006,7 @@ bool check_and_promote_args(ListExpr* const args, RecordType* types) return rval; } -bool check_and_promote_exprs_to_type(ListExpr* const elements, BroType* type) +bool check_and_promote_exprs_to_type(ListExpr* const elements, zeek::Type* type) { expr_list& el = elements->Exprs(); diff --git a/src/Expr.h b/src/Expr.h index 122fe52844..67fad1a9d5 100644 --- a/src/Expr.h +++ b/src/Expr.h @@ -76,9 +76,9 @@ class Stmt; class Expr : public BroObj { public: [[deprecated("Remove in v4.1. Use GetType().")]] - BroType* Type() const { return type.get(); } + zeek::Type* Type() const { return type.get(); } - const IntrusivePtr& GetType() const + const IntrusivePtr& GetType() const { return type; } template @@ -97,7 +97,7 @@ public: // into the given aggregate of the given type. Note that // return type is void since it's updating an existing // value, rather than creating a new one. - virtual void EvalIntoAggregate(const BroType* t, Val* aggr, Frame* f) + virtual void EvalIntoAggregate(const zeek::Type* t, Val* aggr, Frame* f) const; // Assign to the given value, if appropriate. @@ -105,7 +105,7 @@ public: // Returns the type corresponding to this expression interpreted // as an initialization. Returns nil if the initialization is illegal. - virtual IntrusivePtr InitType() const; + virtual IntrusivePtr InitType() const; // Returns true if this expression, interpreted as an initialization, // constitutes a record element, false otherwise. If the TypeDecl* @@ -118,7 +118,7 @@ public: // with the given type. If "aggr" is non-nil, then this expression // is an element of the given aggregate, and it is added to it // accordingly. - virtual IntrusivePtr InitVal(const BroType* t, IntrusivePtr aggr) const; + virtual IntrusivePtr InitVal(const zeek::Type* t, IntrusivePtr aggr) const; // True if the expression has no side effects, false otherwise. virtual bool IsPure() const; @@ -223,7 +223,7 @@ protected: // Puts the expression in canonical form. virtual void Canonicize(); - void SetType(IntrusivePtr t); + void SetType(IntrusivePtr t); // Reports the given error and sets the expression's type to // TYPE_ERROR. @@ -235,7 +235,7 @@ protected: [[noreturn]] void RuntimeErrorWithCallStack(const std::string& msg) const; BroExprTag tag; - IntrusivePtr type; + IntrusivePtr type; bool paren; }; @@ -524,10 +524,10 @@ public: const IntrusivePtr& attrs = nullptr); IntrusivePtr Eval(Frame* f) const override; - void EvalIntoAggregate(const BroType* t, Val* aggr, Frame* f) const override; - IntrusivePtr InitType() const override; + void EvalIntoAggregate(const zeek::Type* t, Val* aggr, Frame* f) const override; + IntrusivePtr InitType() const override; bool IsRecordElement(TypeDecl* td) const override; - IntrusivePtr InitVal(const BroType* t, IntrusivePtr aggr) const override; + IntrusivePtr InitVal(const zeek::Type* t, IntrusivePtr aggr) const override; bool IsPure() const override; protected: @@ -624,7 +624,7 @@ public: ~RecordConstructorExpr() override; protected: - IntrusivePtr InitVal(const BroType* t, IntrusivePtr aggr) const override; + IntrusivePtr InitVal(const zeek::Type* t, IntrusivePtr aggr) const override; IntrusivePtr Fold(Val* v) const override; void ExprDescribe(ODesc* d) const override; @@ -634,7 +634,7 @@ class TableConstructorExpr final : public UnaryExpr { public: TableConstructorExpr(IntrusivePtr constructor_list, std::unique_ptr>> attrs, - IntrusivePtr arg_type = nullptr); + IntrusivePtr arg_type = nullptr); [[deprecated("Remove in v4.1. Use GetAttrs().")]] Attributes* Attrs() { return attrs.get(); } @@ -645,7 +645,7 @@ public: IntrusivePtr Eval(Frame* f) const override; protected: - IntrusivePtr InitVal(const BroType* t, IntrusivePtr aggr) const override; + IntrusivePtr InitVal(const zeek::Type* t, IntrusivePtr aggr) const override; void ExprDescribe(ODesc* d) const override; @@ -656,7 +656,7 @@ class SetConstructorExpr final : public UnaryExpr { public: SetConstructorExpr(IntrusivePtr constructor_list, std::unique_ptr>> attrs, - IntrusivePtr arg_type = nullptr); + IntrusivePtr arg_type = nullptr); [[deprecated("Remove in v4.1. Use GetAttrs().")]] Attributes* Attrs() { return attrs.get(); } @@ -667,7 +667,7 @@ public: IntrusivePtr Eval(Frame* f) const override; protected: - IntrusivePtr InitVal(const BroType* t, IntrusivePtr aggr) const override; + IntrusivePtr InitVal(const zeek::Type* t, IntrusivePtr aggr) const override; void ExprDescribe(ODesc* d) const override; @@ -677,12 +677,12 @@ protected: class VectorConstructorExpr final : public UnaryExpr { public: explicit VectorConstructorExpr(IntrusivePtr constructor_list, - IntrusivePtr arg_type = nullptr); + IntrusivePtr arg_type = nullptr); IntrusivePtr Eval(Frame* f) const override; protected: - IntrusivePtr InitVal(const BroType* t, IntrusivePtr aggr) const override; + IntrusivePtr InitVal(const zeek::Type* t, IntrusivePtr aggr) const override; void ExprDescribe(ODesc* d) const override; }; @@ -693,7 +693,7 @@ public: const char* FieldName() const { return field_name.c_str(); } - void EvalIntoAggregate(const BroType* t, Val* aggr, Frame* f) const override; + void EvalIntoAggregate(const zeek::Type* t, Val* aggr, Frame* f) const override; bool IsRecordElement(TypeDecl* td) const override; protected: @@ -717,7 +717,7 @@ public: ~RecordCoerceExpr() override; protected: - IntrusivePtr InitVal(const BroType* t, IntrusivePtr aggr) const override; + IntrusivePtr InitVal(const zeek::Type* t, IntrusivePtr aggr) const override; IntrusivePtr Fold(Val* v) const override; // For each super-record slot, gives subrecord slot with which to @@ -868,15 +868,15 @@ public: IntrusivePtr Eval(Frame* f) const override; - IntrusivePtr InitType() const override; - IntrusivePtr InitVal(const BroType* t, IntrusivePtr aggr) const override; + IntrusivePtr InitType() const override; + IntrusivePtr InitVal(const zeek::Type* t, IntrusivePtr aggr) const override; IntrusivePtr MakeLvalue() override; void Assign(Frame* f, IntrusivePtr v) override; TraversalCode Traverse(TraversalCallback* cb) const override; protected: - IntrusivePtr AddSetInit(const BroType* t, IntrusivePtr aggr) const; + IntrusivePtr AddSetInit(const zeek::Type* t, IntrusivePtr aggr) const; void ExprDescribe(ODesc* d) const override; @@ -891,7 +891,7 @@ public: class CastExpr final : public UnaryExpr { public: - CastExpr(IntrusivePtr op, IntrusivePtr t); + CastExpr(IntrusivePtr op, IntrusivePtr t); protected: IntrusivePtr Eval(Frame* f) const override; @@ -900,14 +900,14 @@ protected: class IsExpr final : public UnaryExpr { public: - IsExpr(IntrusivePtr op, IntrusivePtr t); + IsExpr(IntrusivePtr op, IntrusivePtr t); protected: IntrusivePtr Fold(Val* v) const override; void ExprDescribe(ODesc* d) const override; private: - IntrusivePtr t; + IntrusivePtr t; }; inline Val* Expr::ExprVal() const @@ -936,11 +936,11 @@ IntrusivePtr get_assign_expr(IntrusivePtr op1, * Returns nullptr if the expression cannot match or a promoted * expression. */ -extern IntrusivePtr check_and_promote_expr(Expr* e, BroType* t); +extern IntrusivePtr check_and_promote_expr(Expr* e, Type* t); extern bool check_and_promote_exprs(ListExpr* elements, TypeList* types); extern bool check_and_promote_args(ListExpr* args, RecordType* types); -extern bool check_and_promote_exprs_to_type(ListExpr* elements, BroType* type); +extern bool check_and_promote_exprs_to_type(ListExpr* elements, Type* type); // Returns a ListExpr simplified down to a list a values, or nil // if they couldn't all be reduced. diff --git a/src/File.h b/src/File.h index 287b140972..a58f1dd650 100644 --- a/src/File.h +++ b/src/File.h @@ -18,7 +18,9 @@ class RecordVal; -FORWARD_DECLARE_NAMESPACED(BroType, zeek); +namespace zeek { class Type; } +using BroType [[deprecated("Remove in v4.1. Use zeek::Type instead.")]] = zeek::Type; + FORWARD_DECLARE_NAMESPACED(PrintStmt, zeek::detail); FORWARD_DECLARE_NAMESPACED(Attributes, zeek::detail); @@ -41,9 +43,9 @@ public: void SetBuf(bool buffered); // false=line buffered, true=fully buffered [[deprecated("Remove in v4.1. Use GetType().")]] - zeek::BroType* FType() const { return t.get(); } + zeek::Type* FType() const { return t.get(); } - const IntrusivePtr& GetType() const + const IntrusivePtr& GetType() const { return t; } // Whether the file is open in a general sense; it might @@ -104,7 +106,7 @@ protected: void RaiseOpenEvent(); FILE* f; - IntrusivePtr t; + IntrusivePtr t; char* name; char* access; zeek::detail::Attributes* attrs; diff --git a/src/Frame.cc b/src/Frame.cc index 7ab9aa2c16..6962b1aa0e 100644 --- a/src/Frame.cc +++ b/src/Frame.cc @@ -460,7 +460,7 @@ std::pair> Frame::Unserialize(const broker::vector& da return std::make_pair(false, nullptr); broker::integer g = *has_type; - zeek::BroType t( static_cast(g) ); + zeek::Type t( static_cast(g) ); auto val = bro_broker::data_to_val(std::move(val_tuple[0]), &t); if ( ! val ) diff --git a/src/ID.cc b/src/ID.cc index 205a5fd749..0c4fcad122 100644 --- a/src/ID.cc +++ b/src/ID.cc @@ -36,7 +36,7 @@ const IntrusivePtr& zeek::id::find(std::string_view name) return global_scope()->Find(name); } -const IntrusivePtr& zeek::id::find_type(std::string_view name) +const IntrusivePtr& zeek::id::find_type(std::string_view name) { auto id = global_scope()->Find(name); @@ -133,7 +133,7 @@ std::string ID::ModuleName() const return extract_module_name(name); } -void ID::SetType(IntrusivePtr t) +void ID::SetType(IntrusivePtr t) { type = std::move(t); } diff --git a/src/ID.h b/src/ID.h index ceeec0af2a..35b354aa6e 100644 --- a/src/ID.h +++ b/src/ID.h @@ -16,7 +16,9 @@ class Val; class Func; -FORWARD_DECLARE_NAMESPACED(BroType, zeek); +namespace zeek { class Type; } +using BroType [[deprecated("Remove in v4.1. Use zeek::Type instead.")]] = zeek::Type; + FORWARD_DECLARE_NAMESPACED(RecordType, zeek); FORWARD_DECLARE_NAMESPACED(TableType, zeek); FORWARD_DECLARE_NAMESPACED(VectorType, zeek); @@ -54,14 +56,14 @@ public: std::string ModuleName() const; - void SetType(IntrusivePtr t); + void SetType(IntrusivePtr t); [[deprecated("Remove in v4.1. Use GetType().")]] - BroType* Type() { return type.get(); } + zeek::Type* Type() { return type.get(); } [[deprecated("Remove in v4.1. Use GetType().")]] - const BroType* Type() const { return type.get(); } + const zeek::Type* Type() const { return type.get(); } - const IntrusivePtr& GetType() const + const IntrusivePtr& GetType() const { return type; } template @@ -69,9 +71,9 @@ public: { return cast_intrusive(type); } [[deprecated("Remove in v4.1. Use IsType() and GetType().")]] - BroType* AsType() { return is_type ? GetType().get() : nullptr; } + zeek::Type* AsType() { return is_type ? GetType().get() : nullptr; } [[deprecated("Remove in v4.1. Use IsType() and GetType().")]] - const BroType* AsType() const { return is_type ? GetType().get() : nullptr; } + const zeek::Type* AsType() const { return is_type ? GetType().get() : nullptr; } bool IsType() const { return is_type; } @@ -172,7 +174,7 @@ protected: IDScope scope; bool is_export; bool infer_return_type; - IntrusivePtr type; + IntrusivePtr type; bool is_const, is_enum_const, is_type, is_option; int offset; IntrusivePtr val; @@ -202,7 +204,7 @@ const IntrusivePtr& find(std::string_view name); * @param name The identifier name to lookup * @return The type of the identifier. */ -const IntrusivePtr& find_type(std::string_view name); +const IntrusivePtr& find_type(std::string_view name); /** * Lookup an ID by its name and return its type (as cast to @c T). diff --git a/src/OpaqueVal.cc b/src/OpaqueVal.cc index 868a2aaade..f1d5c50fca 100644 --- a/src/OpaqueVal.cc +++ b/src/OpaqueVal.cc @@ -96,7 +96,7 @@ IntrusivePtr OpaqueVal::Unserialize(const broker::data& data) return val; } -broker::expected OpaqueVal::SerializeType(const IntrusivePtr& t) +broker::expected OpaqueVal::SerializeType(const IntrusivePtr& t) { if ( t->InternalType() == zeek::TYPE_INTERNAL_ERROR ) return broker::ec::invalid_data; @@ -112,7 +112,7 @@ broker::expected OpaqueVal::SerializeType(const IntrusivePtr(t->Tag())}}; } -IntrusivePtr OpaqueVal::UnserializeType(const broker::data& data) +IntrusivePtr OpaqueVal::UnserializeType(const broker::data& data) { auto v = caf::get_if(&data); if ( ! (v && v->size() == 2) ) @@ -723,7 +723,7 @@ IntrusivePtr BloomFilterVal::DoClone(CloneState* state) return state->NewClone(this, make_intrusive()); } -bool BloomFilterVal::Typify(IntrusivePtr arg_type) +bool BloomFilterVal::Typify(IntrusivePtr arg_type) { if ( type ) return false; @@ -882,7 +882,7 @@ IntrusivePtr CardinalityVal::DoClone(CloneState* state) make_intrusive(new probabilistic::CardinalityCounter(*c))); } -bool CardinalityVal::Typify(IntrusivePtr arg_type) +bool CardinalityVal::Typify(IntrusivePtr arg_type) { if ( type ) return false; diff --git a/src/OpaqueVal.h b/src/OpaqueVal.h index 65db196d50..848e6bed76 100644 --- a/src/OpaqueVal.h +++ b/src/OpaqueVal.h @@ -148,13 +148,13 @@ protected: * Helper function for derived class that need to record a type * during serialization. */ - static broker::expected SerializeType(const IntrusivePtr& t); + static broker::expected SerializeType(const IntrusivePtr& t); /** * Helper function for derived class that need to restore a type * during unserialization. Returns the type at reference count +1. */ - static IntrusivePtr UnserializeType(const broker::data& data); + static IntrusivePtr UnserializeType(const broker::data& data); }; namespace probabilistic { @@ -304,10 +304,10 @@ public: IntrusivePtr DoClone(CloneState* state) override; - const IntrusivePtr& Type() const + const IntrusivePtr& Type() const { return type; } - bool Typify(IntrusivePtr type); + bool Typify(IntrusivePtr type); void Add(const Val* val); size_t Count(const Val* val) const; @@ -328,7 +328,7 @@ private: BloomFilterVal(const BloomFilterVal&); BloomFilterVal& operator=(const BloomFilterVal&); - IntrusivePtr type; + IntrusivePtr type; CompositeHash* hash; probabilistic::BloomFilter* bloom_filter; }; @@ -343,10 +343,10 @@ public: void Add(const Val* val); - const IntrusivePtr& Type() const + const IntrusivePtr& Type() const { return type; } - bool Typify(IntrusivePtr type); + bool Typify(IntrusivePtr type); probabilistic::CardinalityCounter* Get() { return c; }; @@ -355,7 +355,7 @@ protected: DECLARE_OPAQUE_VALUE(CardinalityVal) private: - IntrusivePtr type; + IntrusivePtr type; CompositeHash* hash; probabilistic::CardinalityCounter* c; }; diff --git a/src/Scope.h b/src/Scope.h index e73765cff7..36e505458a 100644 --- a/src/Scope.h +++ b/src/Scope.h @@ -15,7 +15,8 @@ template class IntrusivePtr; class ListVal; -FORWARD_DECLARE_NAMESPACED(BroType, zeek); +namespace zeek { class Type; } +using BroType [[deprecated("Remove in v4.1. Use zeek::Type instead.")]] = zeek::Type; FORWARD_DECLARE_NAMESPACED(ID, zeek::detail); class Scope : public BroObj { @@ -45,9 +46,9 @@ public: { return attrs; } [[deprecated("Remove in v4.1. Use GetReturnTrype().")]] - zeek::BroType* ReturnType() const { return return_type.get(); } + zeek::Type* ReturnType() const { return return_type.get(); } - const IntrusivePtr& GetReturnType() const + const IntrusivePtr& GetReturnType() const { return return_type; } size_t Length() const { return local.size(); } @@ -70,7 +71,7 @@ public: protected: IntrusivePtr scope_id; std::unique_ptr>> attrs; - IntrusivePtr return_type; + IntrusivePtr return_type; std::map, std::less<>> local; std::vector> inits; }; diff --git a/src/Type.cc b/src/Type.cc index fa6519a2be..4c5e1ad45c 100644 --- a/src/Type.cc +++ b/src/Type.cc @@ -24,7 +24,7 @@ using namespace std; namespace zeek { -BroType::TypeAliasMap BroType::type_aliases; +Type::TypeAliasMap Type::type_aliases; // Note: This function must be thread-safe. const char* type_name(zeek::TypeTag t) @@ -64,14 +64,14 @@ const char* type_name(zeek::TypeTag t) return type_names[int(t)]; } -BroType::BroType(zeek::TypeTag t, bool arg_base_type) +Type::Type(zeek::TypeTag t, bool arg_base_type) : tag(t), internal_tag(to_internal_type_tag(tag)), is_network_order(zeek::is_network_order(t)), base_type(arg_base_type) { } -IntrusivePtr BroType::ShallowClone() +IntrusivePtr Type::ShallowClone() { switch ( tag ) { case TYPE_VOID: @@ -89,15 +89,15 @@ IntrusivePtr BroType::ShallowClone() case TYPE_ADDR: case TYPE_SUBNET: case TYPE_ANY: - return make_intrusive(tag, base_type); + return make_intrusive(tag, base_type); default: - reporter->InternalError("cloning illegal base BroType"); + reporter->InternalError("cloning illegal base Type"); } return nullptr; } -int BroType::MatchesIndex(zeek::detail::ListExpr* const index) const +int Type::MatchesIndex(zeek::detail::ListExpr* const index) const { if ( Tag() == TYPE_STRING ) { @@ -111,22 +111,22 @@ int BroType::MatchesIndex(zeek::detail::ListExpr* const index) const return DOES_NOT_MATCH_INDEX; } -const IntrusivePtr& BroType::Yield() const +const IntrusivePtr& Type::Yield() const { - return BroType::nil; + return Type::nil; } -bool BroType::HasField(const char* /* field */) const +bool Type::HasField(const char* /* field */) const { return false; } -BroType* BroType::FieldType(const char* /* field */) const +Type* Type::FieldType(const char* /* field */) const { return nullptr; } -void BroType::Describe(ODesc* d) const +void Type::Describe(ODesc* d) const { if ( d->IsBinary() ) d->Add(int(Tag())); @@ -140,22 +140,22 @@ void BroType::Describe(ODesc* d) const } } -void BroType::DescribeReST(ODesc* d, bool roles_only) const +void Type::DescribeReST(ODesc* d, bool roles_only) const { d->Add(fmt(":zeek:type:`%s`", type_name(Tag()))); } -void BroType::SetError() +void Type::SetError() { tag = TYPE_ERROR; } -unsigned int BroType::MemoryAllocation() const +unsigned int Type::MemoryAllocation() const { return padded_sizeof(*this); } -bool TypeList::AllMatch(const BroType* t, bool is_init) const +bool TypeList::AllMatch(const Type* t, bool is_init) const { for ( const auto& type : types ) if ( ! same_type(type, t, is_init) ) @@ -163,7 +163,7 @@ bool TypeList::AllMatch(const BroType* t, bool is_init) const return true; } -void TypeList::Append(IntrusivePtr t) +void TypeList::Append(IntrusivePtr t) { if ( pure_type && ! same_type(t, pure_type) ) reporter->InternalError("pure type-list violation"); @@ -171,7 +171,7 @@ void TypeList::Append(IntrusivePtr t) types.emplace_back(std::move(t)); } -void TypeList::AppendEvenIfNotPure(IntrusivePtr t) +void TypeList::AppendEvenIfNotPure(IntrusivePtr t) { if ( pure_type && ! same_type(t, pure_type) ) pure_type = nullptr; @@ -215,8 +215,8 @@ unsigned int TypeList::MemoryAllocation() const size += pad_size(types.capacity() * sizeof(decltype(types)::value_type)); - return BroType::MemoryAllocation() - + padded_sizeof(*this) - padded_sizeof(BroType) + return Type::MemoryAllocation() + + padded_sizeof(*this) - padded_sizeof(Type) + size; } @@ -238,7 +238,7 @@ int IndexType::MatchesIndex(zeek::detail::ListExpr* const index) const void IndexType::Describe(ODesc* d) const { - BroType::Describe(d); + Type::Describe(d); if ( ! d->IsBinary() ) d->Add("["); @@ -317,7 +317,7 @@ bool IndexType::IsSubNetIndex() const return false; } -TableType::TableType(IntrusivePtr ind, IntrusivePtr yield) +TableType::TableType(IntrusivePtr ind, IntrusivePtr yield) : IndexType(TYPE_TABLE, std::move(ind), std::move(yield)) { if ( ! indices ) @@ -344,7 +344,7 @@ TableType::TableType(IntrusivePtr ind, IntrusivePtr yield) } } -IntrusivePtr TableType::ShallowClone() +IntrusivePtr TableType::ShallowClone() { return make_intrusive(indices, yield_type); } @@ -378,7 +378,7 @@ SetType::SetType(IntrusivePtr ind, IntrusivePtr ft{NewRef{}, flatten_type(tl[0].get())}; + IntrusivePtr ft{NewRef{}, flatten_type(tl[0].get())}; indices = make_intrusive(ft); indices->Append(std::move(ft)); } @@ -403,7 +403,7 @@ SetType::SetType(IntrusivePtr ind, IntrusivePtr SetType::ShallowClone() +IntrusivePtr SetType::ShallowClone() { return make_intrusive(indices, elements); } @@ -411,8 +411,8 @@ IntrusivePtr SetType::ShallowClone() SetType::~SetType() = default; FuncType::FuncType(IntrusivePtr arg_args, - IntrusivePtr arg_yield, FunctionFlavor arg_flavor) - : BroType(TYPE_FUNC), args(std::move(arg_args)), + IntrusivePtr arg_yield, FunctionFlavor arg_flavor) + : Type(TYPE_FUNC), args(std::move(arg_args)), arg_types(make_intrusive()), yield(std::move(arg_yield)) { flavor = arg_flavor; @@ -441,7 +441,7 @@ FuncType::FuncType(IntrusivePtr arg_args, prototypes.emplace_back(Prototype{false, args, std::move(offsets)}); } -IntrusivePtr FuncType::ShallowClone() +IntrusivePtr FuncType::ShallowClone() { auto f = make_intrusive(); f->args = args; @@ -481,7 +481,7 @@ int FuncType::MatchesIndex(zeek::detail::ListExpr* const index) const bool FuncType::CheckArgs(const type_list* args, bool is_init) const { - std::vector> as; + std::vector> as; as.reserve(args->length()); for ( auto a : *args ) @@ -490,7 +490,7 @@ bool FuncType::CheckArgs(const type_list* args, bool is_init) const return CheckArgs(as, is_init); } -bool FuncType::CheckArgs(const std::vector>& args, +bool FuncType::CheckArgs(const std::vector>& args, bool is_init) const { const auto& my_args = arg_types->Types(); @@ -609,7 +609,7 @@ std::optional FuncType::FindPrototype(const RecordType& arg return {}; } -TypeDecl::TypeDecl(const char* i, IntrusivePtr t, +TypeDecl::TypeDecl(const char* i, IntrusivePtr t, IntrusivePtr arg_attrs) : type(std::move(t)), attrs(std::move(arg_attrs)), @@ -650,7 +650,7 @@ void TypeDecl::DescribeReST(ODesc* d, bool roles_only) const } } -RecordType::RecordType(type_decl_list* arg_types) : BroType(TYPE_RECORD) +RecordType::RecordType(type_decl_list* arg_types) : Type(TYPE_RECORD) { types = arg_types; num_fields = types ? types->length() : 0; @@ -658,7 +658,7 @@ RecordType::RecordType(type_decl_list* arg_types) : BroType(TYPE_RECORD) // in this case the clone is actually not so shallow, since // it gets modified by everyone. -IntrusivePtr RecordType::ShallowClone() +IntrusivePtr RecordType::ShallowClone() { auto pass = new type_decl_list(); for ( const auto& type : *types ) @@ -760,7 +760,7 @@ void RecordType::DescribeReST(ODesc* d, bool roles_only) const d->PopType(this); } -static string container_type_name(const BroType* ft) +static string container_type_name(const Type* ft) { string s; if ( ft->Tag() == TYPE_RECORD ) @@ -1016,7 +1016,7 @@ string RecordType::GetFieldDeprecationWarning(int field, bool has_check) const return ""; } -SubNetType::SubNetType() : BroType(TYPE_SUBNET) +SubNetType::SubNetType() : Type(TYPE_SUBNET) { } @@ -1028,8 +1028,8 @@ void SubNetType::Describe(ODesc* d) const d->Add(int(Tag())); } -FileType::FileType(IntrusivePtr yield_type) - : BroType(TYPE_FILE), yield(std::move(yield_type)) +FileType::FileType(IntrusivePtr yield_type) + : Type(TYPE_FILE), yield(std::move(yield_type)) { } @@ -1049,7 +1049,7 @@ void FileType::Describe(ODesc* d) const } } -OpaqueType::OpaqueType(const string& arg_name) : BroType(TYPE_OPAQUE) +OpaqueType::OpaqueType(const string& arg_name) : Type(TYPE_OPAQUE) { name = arg_name; } @@ -1070,20 +1070,20 @@ void OpaqueType::DescribeReST(ODesc* d, bool roles_only) const } EnumType::EnumType(const string& name) - : BroType(TYPE_ENUM) + : Type(TYPE_ENUM) { counter = 0; SetName(name); } EnumType::EnumType(const EnumType* e) - : BroType(TYPE_ENUM), names(e->names), vals(e->vals) + : Type(TYPE_ENUM), names(e->names), vals(e->vals) { counter = e->counter; SetName(e->GetName()); } -IntrusivePtr EnumType::ShallowClone() +IntrusivePtr EnumType::ShallowClone() { if ( counter == 0 ) return make_intrusive(GetName()); @@ -1166,8 +1166,8 @@ void EnumType::CheckAndAddName(const string& module_name, const char* name, if ( vals.find(val) == vals.end() ) vals[val] = make_intrusive(IntrusivePtr{NewRef{}, this}, val); - set types = BroType::GetAliases(GetName()); - set::const_iterator it; + set types = Type::GetAliases(GetName()); + set::const_iterator it; for ( it = types.begin(); it != types.end(); ++it ) if ( *it != this ) @@ -1303,19 +1303,19 @@ void EnumType::DescribeReST(ODesc* d, bool roles_only) const } } -VectorType::VectorType(IntrusivePtr element_type) - : BroType(TYPE_VECTOR), yield_type(std::move(element_type)) +VectorType::VectorType(IntrusivePtr element_type) + : Type(TYPE_VECTOR), yield_type(std::move(element_type)) { } -IntrusivePtr VectorType::ShallowClone() +IntrusivePtr VectorType::ShallowClone() { return make_intrusive(yield_type); } VectorType::~VectorType() = default; -const IntrusivePtr& VectorType::Yield() const +const IntrusivePtr& VectorType::Yield() const { // Work around the fact that we use void internally to mark a vector // as being unspecified. When looking at its yield type, we need to @@ -1376,7 +1376,7 @@ void VectorType::DescribeReST(ODesc* d, bool roles_only) const // false otherwise. Assumes that t1's tag is different from t2's. Note // that the test is in only one direction - we don't check whether t2 is // initialization-compatible with t1. -static bool is_init_compat(const BroType& t1, const BroType& t2) +static bool is_init_compat(const Type& t1, const Type& t2) { if ( t1.Tag() == TYPE_LIST ) { @@ -1392,7 +1392,7 @@ static bool is_init_compat(const BroType& t1, const BroType& t2) return false; } -bool same_type(const BroType& arg_t1, const BroType& arg_t2, +bool same_type(const Type& arg_t1, const Type& arg_t2, bool is_init, bool match_record_field_names) { if ( &arg_t1 == &arg_t2 || @@ -1587,7 +1587,7 @@ bool record_promotion_compatible(const RecordType* super_rec, return true; } -const BroType* flatten_type(const BroType* t) +const Type* flatten_type(const Type* t) { if ( t->Tag() != TYPE_LIST ) return t; @@ -1610,9 +1610,9 @@ const BroType* flatten_type(const BroType* t) return t; } -BroType* flatten_type(BroType* t) +Type* flatten_type(Type* t) { - return (BroType*) flatten_type((const BroType*) t); + return (Type*) flatten_type((const Type*) t); } bool is_assignable(TypeTag t) @@ -1684,8 +1684,8 @@ TypeTag max_type(TypeTag t1, TypeTag t2) } } -IntrusivePtr merge_types(const IntrusivePtr& arg_t1, - const IntrusivePtr& arg_t2) +IntrusivePtr merge_types(const IntrusivePtr& arg_t1, + const IntrusivePtr& arg_t2) { auto t1 = arg_t1.get(); auto t2 = arg_t2.get(); @@ -1779,7 +1779,7 @@ IntrusivePtr merge_types(const IntrusivePtr& arg_t1, const auto& y1 = t1->Yield(); const auto& y2 = t2->Yield(); - IntrusivePtr y3; + IntrusivePtr y3; if ( y1 || y2 ) { @@ -1924,7 +1924,7 @@ IntrusivePtr merge_types(const IntrusivePtr& arg_t1, } } -IntrusivePtr merge_type_list(zeek::detail::ListExpr* elements) +IntrusivePtr merge_type_list(zeek::detail::ListExpr* elements) { TypeList* tl_type = elements->GetType()->AsTypeList(); const auto& tl = tl_type->Types(); @@ -1950,7 +1950,7 @@ IntrusivePtr merge_type_list(zeek::detail::ListExpr* elements) } // Reduces an aggregate type. -static BroType* reduce_type(BroType* t) +static Type* reduce_type(Type* t) { if ( t->Tag() == TYPE_LIST ) return flatten_type(t); @@ -1969,7 +1969,7 @@ static BroType* reduce_type(BroType* t) return t; } -IntrusivePtr init_type(zeek::detail::Expr* init) +IntrusivePtr init_type(zeek::detail::Expr* init) { if ( init->Tag() != zeek::detail::EXPR_LIST ) { @@ -2016,7 +2016,7 @@ IntrusivePtr init_type(zeek::detail::Expr* init) for ( int i = 1; t && i < el.length(); ++i ) { auto el_t = el[i]->InitType(); - IntrusivePtr ti; + IntrusivePtr ti; if ( el_t ) ti = {NewRef{}, reduce_type(el_t.get())}; @@ -2053,7 +2053,7 @@ IntrusivePtr init_type(zeek::detail::Expr* init) nullptr); } -bool is_atomic_type(const BroType& t) +bool is_atomic_type(const Type& t) { switch ( t.InternalType() ) { case TYPE_INTERNAL_INT: @@ -2068,14 +2068,14 @@ bool is_atomic_type(const BroType& t) } } -const IntrusivePtr& base_type(zeek::TypeTag tag) +const IntrusivePtr& base_type(zeek::TypeTag tag) { - static IntrusivePtr base_types[NUM_TYPES]; + static IntrusivePtr base_types[NUM_TYPES]; // We could check here that "tag" actually corresponds to a basic type. if ( ! base_types[tag] ) { - base_types[tag] = make_intrusive(tag, true); + base_types[tag] = make_intrusive(tag, true); // Give the base types a pseudo-location for easier identification. Location l(type_name(tag), 0, 0, 0, 0); base_types[tag]->SetLocationInfo(&l); diff --git a/src/Type.h b/src/Type.h index c29f6fb32b..c56e5a037b 100644 --- a/src/Type.h +++ b/src/Type.h @@ -185,14 +185,14 @@ constexpr int DOES_NOT_MATCH_INDEX = 0; constexpr int MATCHES_INDEX_SCALAR = 1; constexpr int MATCHES_INDEX_VECTOR = 2; -class BroType : public BroObj { +class Type : public BroObj { public: - static inline const IntrusivePtr nil; + static inline const IntrusivePtr nil; - explicit BroType(zeek::TypeTag tag, bool base_type = false); + explicit Type(zeek::TypeTag tag, bool base_type = false); [[deprecated("Remove in v4.1. Use the version that takes zeek::TypeTag instead.")]] - explicit BroType(::TypeTag tag, bool base_type = false) - : BroType(static_cast(tag), base_type) + explicit Type(::TypeTag tag, bool base_type = false) + : Type(static_cast(tag), base_type) {} // Performs a shallow clone operation of the Bro type. @@ -203,7 +203,7 @@ public: // Clone operations will mostly be implemented in the derived classes; // in addition cloning will be limited to classes that can be reached by // the script-level. - virtual IntrusivePtr ShallowClone(); + virtual IntrusivePtr ShallowClone(); TypeTag Tag() const { return tag; } InternalTypeTag InternalType() const { return internal_tag; } @@ -223,13 +223,13 @@ public: // Returns the type yielded by this type. For example, if // this type is a table[string] of port, then returns the "port" // type. Returns nil if this is not an index type. - virtual const IntrusivePtr& Yield() const; + virtual const IntrusivePtr& Yield() const; [[deprecated("Remove in v4.1. Use Yield() instead.")]] - virtual BroType* YieldType() + virtual Type* YieldType() { return Yield().get(); } [[deprecated("Remove in v4.1. Use Yield() instead.")]] - virtual const BroType* YieldType() const + virtual const Type* YieldType() const { return Yield().get(); } // Returns true if this type is a record and contains the @@ -239,126 +239,126 @@ public: // Returns the type of the given field, or nil if no such field. [[deprecated("Remove in v4.1. Use RecordType::GetFieldType() directly.")]] - virtual BroType* FieldType(const char* field) const; + virtual Type* FieldType(const char* field) const; #define CHECK_TYPE_TAG(tag_type, func_name) \ CHECK_TAG(tag, tag_type, func_name, type_name) const TypeList* AsTypeList() const { - CHECK_TYPE_TAG(TYPE_LIST, "BroType::AsTypeList"); + CHECK_TYPE_TAG(TYPE_LIST, "Type::AsTypeList"); return (const TypeList*) this; } TypeList* AsTypeList() { - CHECK_TYPE_TAG(TYPE_LIST, "BroType::AsTypeList"); + CHECK_TYPE_TAG(TYPE_LIST, "Type::AsTypeList"); return (TypeList*) this; } const TableType* AsTableType() const { - CHECK_TYPE_TAG(TYPE_TABLE, "BroType::AsTableType"); + CHECK_TYPE_TAG(TYPE_TABLE, "Type::AsTableType"); return (const TableType*) this; } TableType* AsTableType() { - CHECK_TYPE_TAG(TYPE_TABLE, "BroType::AsTableType"); + CHECK_TYPE_TAG(TYPE_TABLE, "Type::AsTableType"); return (TableType*) this; } SetType* AsSetType() { if ( ! IsSet() ) - BadTag("BroType::AsSetType", type_name(tag)); + BadTag("Type::AsSetType", type_name(tag)); return (SetType*) this; } const SetType* AsSetType() const { if ( ! IsSet() ) - BadTag("BroType::AsSetType", type_name(tag)); + BadTag("Type::AsSetType", type_name(tag)); return (const SetType*) this; } const RecordType* AsRecordType() const { - CHECK_TYPE_TAG(TYPE_RECORD, "BroType::AsRecordType"); + CHECK_TYPE_TAG(TYPE_RECORD, "Type::AsRecordType"); return (const RecordType*) this; } RecordType* AsRecordType() { - CHECK_TYPE_TAG(TYPE_RECORD, "BroType::AsRecordType"); + CHECK_TYPE_TAG(TYPE_RECORD, "Type::AsRecordType"); return (RecordType*) this; } const SubNetType* AsSubNetType() const { - CHECK_TYPE_TAG(TYPE_SUBNET, "BroType::AsSubNetType"); + CHECK_TYPE_TAG(TYPE_SUBNET, "Type::AsSubNetType"); return (const SubNetType*) this; } SubNetType* AsSubNetType() { - CHECK_TYPE_TAG(TYPE_SUBNET, "BroType::AsSubNetType"); + CHECK_TYPE_TAG(TYPE_SUBNET, "Type::AsSubNetType"); return (SubNetType*) this; } const FuncType* AsFuncType() const { - CHECK_TYPE_TAG(TYPE_FUNC, "BroType::AsFuncType"); + CHECK_TYPE_TAG(TYPE_FUNC, "Type::AsFuncType"); return (const FuncType*) this; } FuncType* AsFuncType() { - CHECK_TYPE_TAG(TYPE_FUNC, "BroType::AsFuncType"); + CHECK_TYPE_TAG(TYPE_FUNC, "Type::AsFuncType"); return (FuncType*) this; } const EnumType* AsEnumType() const { - CHECK_TYPE_TAG(TYPE_ENUM, "BroType::AsEnumType"); + CHECK_TYPE_TAG(TYPE_ENUM, "Type::AsEnumType"); return (EnumType*) this; } EnumType* AsEnumType() { - CHECK_TYPE_TAG(TYPE_ENUM, "BroType::AsEnumType"); + CHECK_TYPE_TAG(TYPE_ENUM, "Type::AsEnumType"); return (EnumType*) this; } const VectorType* AsVectorType() const { - CHECK_TYPE_TAG(TYPE_VECTOR, "BroType::AsVectorType"); + CHECK_TYPE_TAG(TYPE_VECTOR, "Type::AsVectorType"); return (VectorType*) this; } OpaqueType* AsOpaqueType() { - CHECK_TYPE_TAG(TYPE_OPAQUE, "BroType::AsOpaqueType"); + CHECK_TYPE_TAG(TYPE_OPAQUE, "Type::AsOpaqueType"); return (OpaqueType*) this; } const OpaqueType* AsOpaqueType() const { - CHECK_TYPE_TAG(TYPE_OPAQUE, "BroType::AsOpaqueType"); + CHECK_TYPE_TAG(TYPE_OPAQUE, "Type::AsOpaqueType"); return (OpaqueType*) this; } VectorType* AsVectorType() { - CHECK_TYPE_TAG(TYPE_VECTOR, "BroType::AsVectorType"); + CHECK_TYPE_TAG(TYPE_VECTOR, "Type::AsVectorType"); return (VectorType*) this; } const TypeType* AsTypeType() const { - CHECK_TYPE_TAG(TYPE_TYPE, "BroType::AsTypeType"); + CHECK_TYPE_TAG(TYPE_TYPE, "Type::AsTypeType"); return (TypeType*) this; } TypeType* AsTypeType() { - CHECK_TYPE_TAG(TYPE_TYPE, "BroType::AsTypeType"); + CHECK_TYPE_TAG(TYPE_TYPE, "Type::AsTypeType"); return (TypeType*) this; } @@ -372,7 +372,7 @@ public: return tag == TYPE_TABLE && Yield(); } - BroType* Ref() { ::Ref(this); return this; } + Type* Ref() { ::Ref(this); return this; } void Describe(ODesc* d) const override; virtual void DescribeReST(ODesc* d, bool roles_only = false) const; @@ -382,16 +382,16 @@ public: void SetName(const std::string& arg_name) { name = arg_name; } const std::string& GetName() const { return name; } - typedef std::map > TypeAliasMap; + typedef std::map > TypeAliasMap; - static std::set GetAliases(const std::string& type_name) - { return BroType::type_aliases[type_name]; } + static std::set GetAliases(const std::string& type_name) + { return Type::type_aliases[type_name]; } - static void AddAlias(const std::string &type_name, BroType* type) - { BroType::type_aliases[type_name].insert(type); } + static void AddAlias(const std::string &type_name, Type* type) + { Type::type_aliases[type_name].insert(type); } protected: - BroType() { } + Type() = default; void SetError(); @@ -405,48 +405,48 @@ private: static TypeAliasMap type_aliases; }; -class TypeList final : public BroType { +class TypeList final : public Type { public: - explicit TypeList(IntrusivePtr arg_pure_type = nullptr) - : BroType(TYPE_LIST), pure_type(std::move(arg_pure_type)) + explicit TypeList(IntrusivePtr arg_pure_type = nullptr) + : Type(TYPE_LIST), pure_type(std::move(arg_pure_type)) { } - const std::vector>& Types() const + const std::vector>& Types() const { return types; } bool IsPure() const { return pure_type != nullptr; } // Returns the underlying pure type, or nil if the list // is not pure or is empty. - const IntrusivePtr& GetPureType() const + const IntrusivePtr& GetPureType() const { return pure_type; } [[deprecated("Remove in v4.1. Use GetPureType() instead.")]] - BroType* PureType() { return pure_type.get(); } + Type* PureType() { return pure_type.get(); } [[deprecated("Remove in v4.1. Use GetPureType() instead.")]] - const BroType* PureType() const { return pure_type.get(); } + const Type* PureType() const { return pure_type.get(); } // True if all of the types match t, false otherwise. If // is_init is true, then the matching is done in the context // of an initialization. - bool AllMatch(const BroType* t, bool is_init) const; - bool AllMatch(const IntrusivePtr& t, bool is_init) const + bool AllMatch(const Type* t, bool is_init) const; + bool AllMatch(const IntrusivePtr& t, bool is_init) const { return AllMatch(t.get(), is_init); } - void Append(IntrusivePtr t); - void AppendEvenIfNotPure(IntrusivePtr t); + void Append(IntrusivePtr t); + void AppendEvenIfNotPure(IntrusivePtr t); void Describe(ODesc* d) const override; unsigned int MemoryAllocation() const override; protected: - IntrusivePtr pure_type; - std::vector> types; + IntrusivePtr pure_type; + std::vector> types; }; -class IndexType : public BroType { +class IndexType : public Type { public: int MatchesIndex(zeek::detail::ListExpr* index) const override; @@ -456,10 +456,10 @@ public: [[deprecated("Remove in v4.1. Use GetIndices().")]] TypeList* Indices() const { return indices.get(); } - const std::vector>& IndexTypes() const + const std::vector>& IndexTypes() const { return indices->Types(); } - const IntrusivePtr& Yield() const override + const IntrusivePtr& Yield() const override { return yield_type; } void Describe(ODesc* d) const override; @@ -470,8 +470,8 @@ public: protected: IndexType(TypeTag t, IntrusivePtr arg_indices, - IntrusivePtr arg_yield_type) - : BroType(t), indices(std::move(arg_indices)), + IntrusivePtr arg_yield_type) + : Type(t), indices(std::move(arg_indices)), yield_type(std::move(arg_yield_type)) { } @@ -479,14 +479,14 @@ protected: ~IndexType() override; IntrusivePtr indices; - IntrusivePtr yield_type; + IntrusivePtr yield_type; }; class TableType : public IndexType { public: - TableType(IntrusivePtr ind, IntrusivePtr yield); + TableType(IntrusivePtr ind, IntrusivePtr yield); - IntrusivePtr ShallowClone() override; + IntrusivePtr ShallowClone() override; // Returns true if this table type is "unspecified", which is // what one gets using an empty "set()" or "table()" constructor. @@ -498,7 +498,7 @@ public: SetType(IntrusivePtr ind, IntrusivePtr arg_elements); ~SetType() override; - IntrusivePtr ShallowClone() override; + IntrusivePtr ShallowClone() override; [[deprecated("Remove in v4.1. Use Elements() isntead.")]] zeek::detail::ListExpr* SetElements() const { return elements.get(); } @@ -510,7 +510,7 @@ protected: IntrusivePtr elements; }; -class FuncType final : public BroType { +class FuncType final : public Type { public: static inline const IntrusivePtr nil; @@ -525,15 +525,15 @@ public: std::map offsets; }; - FuncType(IntrusivePtr args, IntrusivePtr yield, + FuncType(IntrusivePtr args, IntrusivePtr yield, FunctionFlavor f); [[deprecated("Remove in v4.1. Use the version that takes zeek::FunctionFlavor instead.")]] - FuncType(IntrusivePtr args, IntrusivePtr yield, ::function_flavor f) + FuncType(IntrusivePtr args, IntrusivePtr yield, ::function_flavor f) : FuncType(args, yield, static_cast(f)) {} - IntrusivePtr ShallowClone() override; + IntrusivePtr ShallowClone() override; ~FuncType() override; @@ -543,10 +543,10 @@ public: const IntrusivePtr& Params() const { return args; } - const IntrusivePtr& Yield() const override + const IntrusivePtr& Yield() const override { return yield; } - void SetYieldType(IntrusivePtr arg_yield) { yield = std::move(arg_yield); } + void SetYieldType(IntrusivePtr arg_yield) { yield = std::move(arg_yield); } FunctionFlavor Flavor() const { return flavor; } std::string FlavorString() const; @@ -560,7 +560,7 @@ public: int MatchesIndex(zeek::detail::ListExpr* index) const override; bool CheckArgs(const type_list* args, bool is_init = false) const; - bool CheckArgs(const std::vector>& args, + bool CheckArgs(const std::vector>& args, bool is_init = false) const; [[deprecated("Remove in v4.1. Use ParamList().")]] @@ -591,20 +591,20 @@ public: protected: friend IntrusivePtr make_intrusive(); - FuncType() : BroType(TYPE_FUNC) { flavor = FUNC_FLAVOR_FUNCTION; } + FuncType() : Type(TYPE_FUNC) { flavor = FUNC_FLAVOR_FUNCTION; } IntrusivePtr args; IntrusivePtr arg_types; - IntrusivePtr yield; + IntrusivePtr yield; FunctionFlavor flavor; std::vector prototypes; }; -class TypeType final : public BroType { +class TypeType final : public Type { public: - explicit TypeType(IntrusivePtr t) : BroType(TYPE_TYPE), type(std::move(t)) {} - IntrusivePtr ShallowClone() override { return make_intrusive(type); } + explicit TypeType(IntrusivePtr t) : zeek::Type(TYPE_TYPE), type(std::move(t)) {} + IntrusivePtr ShallowClone() override { return make_intrusive(type); } - const IntrusivePtr& GetType() const + const IntrusivePtr& GetType() const { return type; } template @@ -612,18 +612,18 @@ public: { return cast_intrusive(type); } [[deprecated("Remove in v4.1. Use GetType().")]] - BroType* Type() { return type.get(); } + zeek::Type* Type() { return type.get(); } [[deprecated("Remove in v4.1. Use GetType().")]] - const BroType* Type() const { return type.get(); } + const zeek::Type* Type() const { return type.get(); } protected: - IntrusivePtr type; + IntrusivePtr type; }; class TypeDecl final { public: TypeDecl() = default; - TypeDecl(const char* i, IntrusivePtr t, + TypeDecl(const char* i, IntrusivePtr t, IntrusivePtr attrs = nullptr); TypeDecl(const TypeDecl& other); ~TypeDecl(); @@ -637,38 +637,38 @@ public: void DescribeReST(ODesc* d, bool roles_only = false) const; - IntrusivePtr type; + IntrusivePtr type; IntrusivePtr attrs; const char* id = nullptr; }; using type_decl_list = PList; -class RecordType final : public BroType { +class RecordType final : public Type { public: explicit RecordType(type_decl_list* types); - IntrusivePtr ShallowClone() override; + IntrusivePtr ShallowClone() override; ~RecordType() override; bool HasField(const char* field) const override; [[deprecated("Remove in v4.1. Use GetFieldType() instead (note it doesn't check for invalid names).")]] - BroType* FieldType(const char* field) const override + Type* FieldType(const char* field) const override { auto offset = FieldOffset(field); return offset >= 0 ? GetFieldType(offset).get() : nullptr; } [[deprecated("Remove in v4.1. Use GetFieldType() instead.")]] - BroType* FieldType(int field) const + Type* FieldType(int field) const { return GetFieldType(field).get(); } /** * Looks up a field by name and returns its type. No check for invalid * field name is performed. */ - const IntrusivePtr& GetFieldType(const char* field_name) const + const IntrusivePtr& GetFieldType(const char* field_name) const { return GetFieldType(FieldOffset(field_name)); } /** @@ -683,7 +683,7 @@ public: * Looks up a field by its index and returns its type. No check for * invalid field offset is performed. */ - const IntrusivePtr& GetFieldType(int field_index) const + const IntrusivePtr& GetFieldType(int field_index) const { return (*types)[field_index]->type; } /** @@ -753,31 +753,31 @@ protected: type_decl_list* types; }; -class SubNetType final : public BroType { +class SubNetType final : public Type { public: SubNetType(); void Describe(ODesc* d) const override; }; -class FileType final : public BroType { +class FileType final : public Type { public: - explicit FileType(IntrusivePtr yield_type); - IntrusivePtr ShallowClone() override { return make_intrusive(yield); } + explicit FileType(IntrusivePtr yield_type); + IntrusivePtr ShallowClone() override { return make_intrusive(yield); } ~FileType() override; - const IntrusivePtr& Yield() const override + const IntrusivePtr& Yield() const override { return yield; } void Describe(ODesc* d) const override; protected: - IntrusivePtr yield; + IntrusivePtr yield; }; -class OpaqueType final : public BroType { +class OpaqueType final : public Type { public: explicit OpaqueType(const std::string& name); - IntrusivePtr ShallowClone() override { return make_intrusive(name); } + IntrusivePtr ShallowClone() override { return make_intrusive(name); } ~OpaqueType() override { }; const std::string& Name() const { return name; } @@ -791,13 +791,13 @@ protected: std::string name; }; -class EnumType final : public BroType { +class EnumType final : public Type { public: typedef std::list > enum_name_list; explicit EnumType(const EnumType* e); explicit EnumType(const std::string& arg_name); - IntrusivePtr ShallowClone() override; + IntrusivePtr ShallowClone() override; ~EnumType() override; // The value of this name is next internal counter value, starting @@ -844,13 +844,13 @@ protected: bro_int_t counter; }; -class VectorType final : public BroType { +class VectorType final : public Type { public: - explicit VectorType(IntrusivePtr t); - IntrusivePtr ShallowClone() override; + explicit VectorType(IntrusivePtr t); + IntrusivePtr ShallowClone() override; ~VectorType() override; - const IntrusivePtr& Yield() const override; + const IntrusivePtr& Yield() const override; int MatchesIndex(zeek::detail::ListExpr* index) const override; @@ -862,24 +862,24 @@ public: void DescribeReST(ODesc* d, bool roles_only = false) const override; protected: - IntrusivePtr yield_type; + IntrusivePtr yield_type; }; // True if the two types are equivalent. If is_init is true then the test is // done in the context of an initialization. If match_record_field_names is // true then for record types the field names have to match, too. -extern bool same_type(const BroType& t1, const BroType& t2, +extern bool same_type(const Type& t1, const Type& t2, bool is_init=false, bool match_record_field_names=true); -inline bool same_type(const IntrusivePtr& t1, const IntrusivePtr& t2, +inline bool same_type(const IntrusivePtr& t1, const IntrusivePtr& t2, bool is_init=false, bool match_record_field_names=true) { return same_type(*t1, *t2, is_init, match_record_field_names); } -inline bool same_type(const BroType* t1, const BroType* t2, +inline bool same_type(const Type* t1, const Type* t2, bool is_init=false, bool match_record_field_names=true) { return same_type(*t1, *t2, is_init, match_record_field_names); } -inline bool same_type(const IntrusivePtr& t1, const BroType* t2, +inline bool same_type(const IntrusivePtr& t1, const Type* t2, bool is_init=false, bool match_record_field_names=true) { return same_type(*t1, *t2, is_init, match_record_field_names); } -inline bool same_type(const BroType* t1, const IntrusivePtr& t2, +inline bool same_type(const Type* t1, const IntrusivePtr& t2, bool is_init=false, bool match_record_field_names=true) { return same_type(*t1, *t2, is_init, match_record_field_names); } @@ -891,10 +891,10 @@ extern bool same_attrs(const zeek::detail::Attributes* a1, const zeek::detail::A extern bool record_promotion_compatible(const RecordType* super_rec, const RecordType* sub_rec); -// If the given BroType is a TypeList with just one element, returns +// If the given Type is a TypeList with just one element, returns // that element, otherwise returns the type. -extern const BroType* flatten_type(const BroType* t); -extern BroType* flatten_type(BroType* t); +extern const Type* flatten_type(const Type* t); +extern Type* flatten_type(Type* t); // Returns the "maximum" of two type tags, in a type-promotion sense. extern TypeTag max_type(TypeTag t1, TypeTag t2); @@ -902,27 +902,27 @@ extern TypeTag max_type(TypeTag t1, TypeTag t2); // Given two types, returns the "merge", in which promotable types // are promoted to the maximum of the two. Returns nil (and generates // an error message) if the types are incompatible. -IntrusivePtr merge_types(const IntrusivePtr& t1, - const IntrusivePtr& t2); +IntrusivePtr merge_types(const IntrusivePtr& t1, + const IntrusivePtr& t2); // Given a list of expressions, returns a (ref'd) type reflecting // a merged type consistent across all of them, or nil if this // cannot be done. -IntrusivePtr merge_type_list(zeek::detail::ListExpr* elements); +IntrusivePtr merge_type_list(zeek::detail::ListExpr* elements); // Given an expression, infer its type when used for an initialization. -IntrusivePtr init_type(zeek::detail::Expr* init); +IntrusivePtr init_type(zeek::detail::Expr* init); // Returns true if argument is an atomic type. -bool is_atomic_type(const BroType& t); -inline bool is_atomic_type(const BroType* t) +bool is_atomic_type(const Type& t); +inline bool is_atomic_type(const Type* t) { return is_atomic_type(*t); } -inline bool is_atomic_type(const IntrusivePtr& t) +inline bool is_atomic_type(const IntrusivePtr& t) { return is_atomic_type(*t); } // True if the given type tag corresponds to type that can be assigned to. extern bool is_assignable(TypeTag t); -inline bool is_assignable(BroType* t) +inline bool is_assignable(Type* t) { return zeek::is_assignable(t->Tag()); } // True if the given type tag corresponds to an integral type. @@ -974,17 +974,17 @@ inline bool BothString(TypeTag t1, TypeTag t2) { return (IsString(t1) && IsStrin inline bool EitherError(TypeTag t1, TypeTag t2) { return (IsErrorType(t1) || IsErrorType(t2)); } // Returns the basic (non-parameterized) type with the given type. -const IntrusivePtr& base_type(zeek::TypeTag tag); +const IntrusivePtr& base_type(zeek::TypeTag tag); // Returns the basic error type. -inline const IntrusivePtr& error_type() { return base_type(TYPE_ERROR); } +inline const IntrusivePtr& error_type() { return base_type(TYPE_ERROR); } } // namespace zeek // Returns the basic (non-parameterized) type with the given type. // The reference count of the type is not increased. [[deprecated("Remove in v4.1. Use zeek::base_type() instead")]] -inline zeek::BroType* base_type_no_ref(TypeTag tag) +inline zeek::Type* base_type_no_ref(TypeTag tag) { return zeek::base_type(static_cast(tag)).get(); } extern IntrusivePtr md5_type; @@ -998,7 +998,7 @@ extern IntrusivePtr x509_opaque_type; extern IntrusivePtr ocsp_resp_opaque_type; extern IntrusivePtr paraglob_type; -using BroType [[deprecated("Remove in v4.1. Use zeek::BroType instead.")]] = zeek::BroType; +using BroType [[deprecated("Remove in v4.1. Use zeek::Type instead.")]] = zeek::Type; using TypeList [[deprecated("Remove in v4.1. Use zeek::TypeList instead.")]] = zeek::TypeList; using IndexType [[deprecated("Remove in v4.1. Use zeek::IndexType instead.")]] = zeek::IndexType; using TableType [[deprecated("Remove in v4.1. Use zeek::TableType instead.")]] = zeek::TableType; diff --git a/src/Val.cc b/src/Val.cc index e0b64945d8..0823c56a70 100644 --- a/src/Val.cc +++ b/src/Val.cc @@ -391,7 +391,7 @@ void Val::SetID(zeek::detail::ID* id) } #endif -bool Val::WouldOverflow(const zeek::BroType* from_type, const zeek::BroType* to_type, const Val* val) +bool Val::WouldOverflow(const zeek::Type* from_type, const zeek::Type* to_type, const Val* val) { if ( !to_type || !from_type ) return true; @@ -1337,7 +1337,7 @@ static void table_entry_val_delete_func(void* val) delete tv; } -static void find_nested_record_types(const IntrusivePtr& t, std::set* found) +static void find_nested_record_types(const IntrusivePtr& t, std::set* found) { if ( ! t ) return; @@ -3188,14 +3188,14 @@ void VectorVal::ValDescribe(ODesc* d) const d->Add("]"); } -IntrusivePtr check_and_promote(IntrusivePtr v, const zeek::BroType* t, +IntrusivePtr check_and_promote(IntrusivePtr v, const zeek::Type* t, bool is_init, const Location* expr_location) { if ( ! v ) return nullptr; - zeek::BroType* vt = flatten_type(v->GetType().get()); + zeek::Type* vt = flatten_type(v->GetType().get()); t = flatten_type(t); zeek::TypeTag t_tag = t->Tag(); @@ -3392,7 +3392,7 @@ void delete_vals(val_list* vals) } } -IntrusivePtr cast_value_to_type(Val* v, zeek::BroType* t) +IntrusivePtr cast_value_to_type(Val* v, zeek::Type* t) { // Note: when changing this function, adapt all three of // cast_value_to_type()/can_cast_value_to_type()/can_cast_value_to_type(). @@ -3418,7 +3418,7 @@ IntrusivePtr cast_value_to_type(Val* v, zeek::BroType* t) return nullptr; } -bool can_cast_value_to_type(const Val* v, zeek::BroType* t) +bool can_cast_value_to_type(const Val* v, zeek::Type* t) { // Note: when changing this function, adapt all three of // cast_value_to_type()/can_cast_value_to_type()/can_cast_value_to_type(). @@ -3444,7 +3444,7 @@ bool can_cast_value_to_type(const Val* v, zeek::BroType* t) return false; } -bool can_cast_value_to_type(const zeek::BroType* s, zeek::BroType* t) +bool can_cast_value_to_type(const zeek::Type* s, zeek::Type* t) { // Note: when changing this function, adapt all three of // cast_value_to_type()/can_cast_value_to_type()/can_cast_value_to_type(). diff --git a/src/Val.h b/src/Val.h index 1aebc0f887..599cff20c3 100644 --- a/src/Val.h +++ b/src/Val.h @@ -140,12 +140,12 @@ public: explicit Val(IntrusivePtr f); // Extra arg to differentiate from protected version. - Val(IntrusivePtr t, bool type_type) + Val(IntrusivePtr t, bool type_type) : type(make_intrusive(std::move(t))) {} [[deprecated("Remove in v4.1. Construct from IntrusivePtr instead.")]] - Val(zeek::BroType* t, bool type_type) : Val({NewRef{}, t}, type_type) + Val(zeek::Type* t, bool type_type) : Val({NewRef{}, t}, type_type) {} Val() @@ -185,11 +185,11 @@ public: virtual bool RemoveFrom(Val* v) const; [[deprecated("Remove in v4.1. Use GetType().")]] - zeek::BroType* Type() { return type.get(); } + zeek::Type* Type() { return type.get(); } [[deprecated("Remove in v4.1. Use GetType().")]] - const zeek::BroType* Type() const { return type.get(); } + const zeek::Type* Type() const { return type.get(); } - const IntrusivePtr& GetType() const + const IntrusivePtr& GetType() const { return type; } template @@ -233,7 +233,7 @@ public: return *val.subnet_val; } - zeek::BroType* AsType() const + zeek::Type* AsType() const { CHECK_TAG(type->Tag(), zeek::TYPE_TYPE, "Val::Type", zeek::type_name) return type.get(); @@ -333,7 +333,7 @@ public: void SetID(zeek::detail::ID* id); #endif - static bool WouldOverflow(const zeek::BroType* from_type, const zeek::BroType* to_type, const Val* val); + static bool WouldOverflow(const zeek::Type* from_type, const zeek::Type* to_type, const Val* val); IntrusivePtr GetRecordFields(); @@ -361,11 +361,11 @@ protected: {} template - Val(V&& v, IntrusivePtr t) noexcept + Val(V&& v, IntrusivePtr t) noexcept : val(std::forward(v)), type(std::move(t)) {} - explicit Val(IntrusivePtr t) noexcept + explicit Val(IntrusivePtr t) noexcept : type(std::move(t)) {} @@ -386,7 +386,7 @@ protected: virtual IntrusivePtr DoClone(CloneState* state); BroValUnion val; - IntrusivePtr type; + IntrusivePtr type; #ifdef DEBUG // For debugging, we keep the name of the ID to which a Val is bound. @@ -1372,7 +1372,7 @@ protected: // If not a match, generates an error message and return nil. If is_init is // true, then the checking is done in the context of an initialization. extern IntrusivePtr check_and_promote(IntrusivePtr v, - const zeek::BroType* t, bool is_init, + const zeek::Type* t, bool is_init, const Location* expr_location = nullptr); extern bool same_val(const Val* v1, const Val* v2); @@ -1390,16 +1390,16 @@ inline bool is_vector(const IntrusivePtr& v) { return is_vector(v.get()); } // Returns v casted to type T if the type supports that. Returns null if not. // // Note: This implements the script-level cast operator. -extern IntrusivePtr cast_value_to_type(Val* v, zeek::BroType* t); +extern IntrusivePtr cast_value_to_type(Val* v, zeek::Type* t); // Returns true if v can be casted to type T. If so, check_and_cast() will // succeed as well. // // Note: This implements the script-level type comparision operator. -extern bool can_cast_value_to_type(const Val* v, zeek::BroType* t); +extern bool can_cast_value_to_type(const Val* v, zeek::Type* t); // Returns true if values of type s may support casting to type t. This is // purely static check to weed out cases early on that will never succeed. // However, even this function returns true, casting may still fail for a // specific instance later. -extern bool can_cast_value_to_type(const zeek::BroType* s, zeek::BroType* t); +extern bool can_cast_value_to_type(const zeek::Type* s, zeek::Type* t); diff --git a/src/Var.cc b/src/Var.cc index 85dc5bcd83..b3305cf2fa 100644 --- a/src/Var.cc +++ b/src/Var.cc @@ -19,7 +19,7 @@ using namespace zeek::detail; -static IntrusivePtr init_val(zeek::detail::Expr* init, const zeek::BroType* t, +static IntrusivePtr init_val(zeek::detail::Expr* init, const zeek::Type* t, IntrusivePtr aggr) { try @@ -32,7 +32,7 @@ static IntrusivePtr init_val(zeek::detail::Expr* init, const zeek::BroType* } } -static bool add_prototype(const IntrusivePtr& id, zeek::BroType* t, +static bool add_prototype(const IntrusivePtr& id, zeek::Type* t, std::vector>* attrs, const IntrusivePtr& init) { @@ -110,7 +110,7 @@ static bool add_prototype(const IntrusivePtr& id, zeek::BroTyp return true; } -static void make_var(const IntrusivePtr& id, IntrusivePtr t, +static void make_var(const IntrusivePtr& id, IntrusivePtr t, zeek::detail::init_class c, IntrusivePtr init, std::unique_ptr>> attr, @@ -310,7 +310,7 @@ static void make_var(const IntrusivePtr& id, IntrusivePtr& id, IntrusivePtr t, +void add_global(const IntrusivePtr& id, IntrusivePtr t, zeek::detail::init_class c, IntrusivePtr init, std::unique_ptr>> attr, decl_type dt) @@ -318,7 +318,7 @@ void add_global(const IntrusivePtr& id, IntrusivePtr add_local(IntrusivePtr id, IntrusivePtr t, +IntrusivePtr add_local(IntrusivePtr id, IntrusivePtr t, zeek::detail::init_class c, IntrusivePtr init, std::unique_ptr>> attr, decl_type dt) @@ -360,12 +360,12 @@ extern IntrusivePtr add_and_assign_local(IntrusivePtr t, +void add_type(zeek::detail::ID* id, IntrusivePtr t, std::unique_ptr>> attr) { std::string new_type_name = id->Name(); std::string old_type_name = t->GetName(); - IntrusivePtr tnew; + IntrusivePtr tnew; if ( (t->Tag() == zeek::TYPE_RECORD || t->Tag() == zeek::TYPE_ENUM) && old_type_name.empty() ) @@ -375,10 +375,10 @@ void add_type(zeek::detail::ID* id, IntrusivePtr t, // Clone the type to preserve type name aliasing. tnew = t->ShallowClone(); - zeek::BroType::AddAlias(new_type_name, tnew.get()); + zeek::Type::AddAlias(new_type_name, tnew.get()); if ( new_type_name != old_type_name && ! old_type_name.empty() ) - zeek::BroType::AddAlias(old_type_name, tnew.get()); + zeek::Type::AddAlias(old_type_name, tnew.get()); tnew->SetName(id->Name()); @@ -769,7 +769,7 @@ ListVal* internal_list_val(const char* name) return nullptr; } -zeek::BroType* internal_type(const char* name) +zeek::Type* internal_type(const char* name) { return zeek::id::find_type(name).get(); } diff --git a/src/Var.h b/src/Var.h index 83809f2cbe..81858dec69 100644 --- a/src/Var.h +++ b/src/Var.h @@ -19,14 +19,14 @@ 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, - IntrusivePtr t, + IntrusivePtr t, zeek::detail::init_class c, IntrusivePtr init, std::unique_ptr>> attr, decl_type dt); extern IntrusivePtr add_local(IntrusivePtr id, - IntrusivePtr t, + IntrusivePtr t, zeek::detail::init_class c, IntrusivePtr init, std::unique_ptr>> attr, @@ -36,7 +36,7 @@ extern IntrusivePtr add_and_assign_local(IntrusivePtr init, IntrusivePtr val = nullptr); -extern void add_type(zeek::detail::ID* id, IntrusivePtr t, +extern void add_type(zeek::detail::ID* id, IntrusivePtr t, std::unique_ptr>> attr); extern void begin_func(IntrusivePtr id, const char* module_name, @@ -77,7 +77,7 @@ extern TableVal* opt_internal_table(const char* name); // nil if not defined extern ListVal* internal_list_val(const char* name); [[deprecated("Remove in v4.1. Use zeek::id::find_type().")]] -extern zeek::BroType* internal_type(const char* name); +extern zeek::Type* internal_type(const char* name); [[deprecated("Remove in v4.1. Use zeek::id::find_func().")]] extern Func* internal_func(const char* name); diff --git a/src/broker/Data.cc b/src/broker/Data.cc index b101f09ed8..33413c74f0 100644 --- a/src/broker/Data.cc +++ b/src/broker/Data.cc @@ -20,7 +20,7 @@ IntrusivePtr bro_broker::opaque_of_table_iterator; IntrusivePtr bro_broker::opaque_of_vector_iterator; IntrusivePtr bro_broker::opaque_of_record_iterator; -static bool data_type_check(const broker::data& d, zeek::BroType* t); +static bool data_type_check(const broker::data& d, zeek::Type* t); static broker::port::protocol to_broker_port_proto(TransportProto tp) { @@ -75,7 +75,7 @@ TEST_CASE("converting Broker to Zeek protocol constants") struct val_converter { using result_type = IntrusivePtr; - zeek::BroType* type; + zeek::Type* type; result_type operator()(broker::none) { @@ -445,7 +445,7 @@ struct val_converter { struct type_checker { using result_type = bool; - zeek::BroType* type; + zeek::Type* type; result_type operator()(broker::none) { @@ -771,7 +771,7 @@ struct type_checker { } }; -static bool data_type_check(const broker::data& d, zeek::BroType* t) +static bool data_type_check(const broker::data& d, zeek::Type* t) { if ( t->Tag() == zeek::TYPE_ANY ) return true; @@ -779,7 +779,7 @@ static bool data_type_check(const broker::data& d, zeek::BroType* t) return caf::visit(type_checker{t}, d); } -IntrusivePtr bro_broker::data_to_val(broker::data d, zeek::BroType* type) +IntrusivePtr bro_broker::data_to_val(broker::data d, zeek::Type* type) { if ( type->Tag() == zeek::TYPE_ANY ) return bro_broker::make_data_val(move(d)); @@ -1137,17 +1137,17 @@ void bro_broker::DataVal::ValDescribe(ODesc* d) const d->Add("}"); } -bool bro_broker::DataVal::canCastTo(zeek::BroType* t) const +bool bro_broker::DataVal::canCastTo(zeek::Type* t) const { return data_type_check(data, t); } -IntrusivePtr bro_broker::DataVal::castTo(zeek::BroType* t) +IntrusivePtr bro_broker::DataVal::castTo(zeek::Type* t) { return data_to_val(data, t); } -const IntrusivePtr& bro_broker::DataVal::ScriptDataType() +const IntrusivePtr& bro_broker::DataVal::ScriptDataType() { static auto script_data_type = zeek::id::find_type("Broker::Data"); return script_data_type; diff --git a/src/broker/Data.h b/src/broker/Data.h index 284d6ec46f..b467576810 100644 --- a/src/broker/Data.h +++ b/src/broker/Data.h @@ -65,7 +65,7 @@ broker::expected val_to_data(const Val* v); * @return a pointer to a new Bro value or a nullptr if the conversion was not * possible. */ -IntrusivePtr data_to_val(broker::data d, zeek::BroType* type); +IntrusivePtr data_to_val(broker::data d, zeek::Type* type); /** * Convert a Bro threading::Value to a Broker data value. @@ -109,13 +109,13 @@ public: void ValDescribe(ODesc* d) const override; - IntrusivePtr castTo(zeek::BroType* t); - bool canCastTo(zeek::BroType* t) const; + IntrusivePtr castTo(zeek::Type* t); + bool canCastTo(zeek::Type* t) const; // Returns the Bro type that scripts use to represent a Broker data // instance. This may be wrapping the opaque value inside another // type. - static const IntrusivePtr& ScriptDataType(); + static const IntrusivePtr& ScriptDataType(); broker::data data; diff --git a/src/broker/messaging.bif b/src/broker/messaging.bif index 481d172423..f135388d88 100644 --- a/src/broker/messaging.bif +++ b/src/broker/messaging.bif @@ -7,7 +7,7 @@ #include #include -static bool is_string_set(const zeek::BroType* type) +static bool is_string_set(const zeek::Type* type) { if ( ! type->IsSet() ) return false; diff --git a/src/input/Manager.cc b/src/input/Manager.cc index 20159e48ad..1664b54f09 100644 --- a/src/input/Manager.cc +++ b/src/input/Manager.cc @@ -774,7 +774,7 @@ bool Manager::CreateAnalysisStream(RecordVal* fval) return true; } -bool Manager::IsCompatibleType(zeek::BroType* t, bool atomic_only) +bool Manager::IsCompatibleType(zeek::Type* t, bool atomic_only) { if ( ! t ) return false; @@ -2159,7 +2159,7 @@ HashKey* Manager::HashValues(const int num_elements, const Value* const *vals) c // have_error is a reference to a boolean which is set to true as soon as an error occurs. // When have_error is set to true at the beginning of the function, it is assumed that // an error already occurred in the past and processing is aborted. -Val* Manager::ValueToVal(const Stream* i, const Value* val, zeek::BroType* request_type, bool& have_error) const +Val* Manager::ValueToVal(const Stream* i, const Value* val, zeek::Type* request_type, bool& have_error) const { if ( have_error ) return nullptr; diff --git a/src/input/Manager.h b/src/input/Manager.h index d458055472..8f5d7df3f6 100644 --- a/src/input/Manager.h +++ b/src/input/Manager.h @@ -111,7 +111,7 @@ public: * * @return True if the type is compatible with the input framework. */ - static bool IsCompatibleType(zeek::BroType* t, bool atomic_only=false); + static bool IsCompatibleType(zeek::Type* t, bool atomic_only=false); protected: friend class ReaderFrontend; @@ -222,7 +222,7 @@ private: int CopyValue(char *data, const int startpos, const threading::Value* val) const; // Convert Threading::Value to an internal Bro Type (works with Records). - Val* ValueToVal(const Stream* i, const threading::Value* val, zeek::BroType* request_type, bool& have_error) const; + Val* ValueToVal(const Stream* i, const threading::Value* val, zeek::Type* request_type, bool& have_error) const; // Convert Threading::Value to an internal Bro list type. Val* ValueToIndexVal(const Stream* i, int num_fields, const zeek::RecordType* type, const threading::Value* const *vals, bool& have_error) const; diff --git a/src/logging/Manager.cc b/src/logging/Manager.cc index 0457f9f506..1547c5bd55 100644 --- a/src/logging/Manager.cc +++ b/src/logging/Manager.cc @@ -913,7 +913,7 @@ bool Manager::Write(EnumVal* id, RecordVal* columns_arg) return true; } -threading::Value* Manager::ValToLogVal(Val* val, zeek::BroType* ty) +threading::Value* Manager::ValToLogVal(Val* val, zeek::Type* ty) { if ( ! ty ) ty = val->GetType().get(); diff --git a/src/logging/Manager.h b/src/logging/Manager.h index eec4fcd988..23a61f9d69 100644 --- a/src/logging/Manager.h +++ b/src/logging/Manager.h @@ -261,7 +261,7 @@ private: threading::Value** RecordToFilterVals(Stream* stream, Filter* filter, RecordVal* columns); - threading::Value* ValToLogVal(Val* val, zeek::BroType* ty = nullptr); + threading::Value* ValToLogVal(Val* val, zeek::Type* ty = nullptr); Stream* FindStream(EnumVal* id); void RemoveDisabledWriters(Stream* stream); void InstallRotationTimer(WriterInfo* winfo); diff --git a/src/parse.y b/src/parse.y index 9d9ba8606a..d4781a7ef4 100644 --- a/src/parse.y +++ b/src/parse.y @@ -169,7 +169,7 @@ static void parser_redef_enum (zeek::detail::ID *id) static void extend_record(zeek::detail::ID* id, std::unique_ptr fields, std::unique_ptr>> attrs) { - std::set types = zeek::BroType::GetAliases(id->Name()); + std::set types = zeek::Type::GetAliases(id->Name()); if ( types.empty() ) { @@ -201,7 +201,7 @@ static void extend_record(zeek::detail::ID* id, std::unique_ptr make_attributes(std::vector>* attrs, - IntrusivePtr t, bool in_record, bool is_global) + IntrusivePtr t, bool in_record, bool is_global) { if ( ! attrs ) return nullptr; @@ -241,7 +241,7 @@ static bool expr_is_table_type_name(const zeek::detail::Expr* expr) zeek::detail::EventExpr* event_expr; zeek::detail::Stmt* stmt; zeek::detail::ListExpr* list; - zeek::BroType* type; + zeek::Type* type; zeek::RecordType* record; zeek::FuncType* func_type; zeek::TypeList* type_l; @@ -1667,7 +1667,7 @@ case_type: | TOK_TYPE type TOK_AS TOK_ID { const char* name = $4; - IntrusivePtr type{AdoptRef{}, $2}; + IntrusivePtr type{AdoptRef{}, $2}; auto case_var = lookup_ID(name, current_module.c_str()); if ( case_var && case_var->IsGlobal() ) diff --git a/src/probabilistic/Topk.cc b/src/probabilistic/Topk.cc index 98411fbd59..1cd1027b1e 100644 --- a/src/probabilistic/Topk.cc +++ b/src/probabilistic/Topk.cc @@ -18,7 +18,7 @@ static void topk_element_hash_delete_func(void* val) delete e; } -void TopkVal::Typify(IntrusivePtr t) +void TopkVal::Typify(IntrusivePtr t) { assert(!hash && !type); type = std::move(t); diff --git a/src/probabilistic/Topk.h b/src/probabilistic/Topk.h index fcfcb2c61f..24db217a59 100644 --- a/src/probabilistic/Topk.h +++ b/src/probabilistic/Topk.h @@ -161,9 +161,9 @@ private: * * @param t type that is tracked */ - void Typify(IntrusivePtr t); + void Typify(IntrusivePtr t); - IntrusivePtr type; + IntrusivePtr type; CompositeHash* hash; std::list buckets; PDict* elementDict; diff --git a/src/threading/SerialTypes.cc b/src/threading/SerialTypes.cc index 45dae236a3..c2a0610561 100644 --- a/src/threading/SerialTypes.cc +++ b/src/threading/SerialTypes.cc @@ -122,7 +122,7 @@ Value::~Value() } } -bool Value::IsCompatibleType(zeek::BroType* t, bool atomic_only) +bool Value::IsCompatibleType(zeek::Type* t, bool atomic_only) { if ( ! t ) return false; @@ -535,7 +535,7 @@ Val* Value::ValueToVal(const std::string& source, const Value* val, bool& have_e if ( stag == zeek::TYPE_VOID ) stag = val->val.set_val.vals[0]->type; - IntrusivePtr index_type; + IntrusivePtr index_type; if ( stag == zeek::TYPE_ENUM ) { @@ -575,7 +575,7 @@ Val* Value::ValueToVal(const std::string& source, const Value* val, bool& have_e case zeek::TYPE_VECTOR: { - IntrusivePtr type; + IntrusivePtr type; if ( val->val.vector_val.size == 0 && val->subtype == zeek::TYPE_VOID ) // don't know type - unspecified table. diff --git a/src/threading/SerialTypes.h b/src/threading/SerialTypes.h index 355fcc0837..1fc816c2f9 100644 --- a/src/threading/SerialTypes.h +++ b/src/threading/SerialTypes.h @@ -202,7 +202,7 @@ struct Value { * Returns true if the type can be represented by a Value. If * `atomic_only` is true, will not permit composite types. This * method is thread-safe. */ - static bool IsCompatibleType(zeek::BroType* t, bool atomic_only=false); + static bool IsCompatibleType(zeek::Type* t, bool atomic_only=false); /** * Convenience function to delete an array of value pointers.