mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 02:28:21 +00:00
Mark one-parameter constructors as explicit & use override where possible
This commit marks (hopefully) ever one-parameter constructor as explicit. It also uses override in (hopefully) all circumstances where a virtual method is overridden. There are a very few other minor changes - most of them were necessary to get everything to compile (like one additional constructor). In one case I changed an implicit operation to an explicit string conversion - I think the automatically chosen conversion was much more convoluted. This took longer than I want to admit but not as long as I feared :)
This commit is contained in:
parent
1f2bf50b49
commit
6d612ced3d
173 changed files with 1052 additions and 1046 deletions
70
src/Expr.h
70
src/Expr.h
|
@ -63,7 +63,7 @@ public:
|
|||
BroType* Type() const { return type; }
|
||||
BroExprTag Tag() const { return tag; }
|
||||
|
||||
virtual ~Expr();
|
||||
~Expr() override;
|
||||
|
||||
Expr* Ref() { ::Ref(this); return this; }
|
||||
|
||||
|
@ -182,7 +182,7 @@ public:
|
|||
return (AssignExpr*) this;
|
||||
}
|
||||
|
||||
void Describe(ODesc* d) const;
|
||||
void Describe(ODesc* d) const override;
|
||||
|
||||
bool Serialize(SerialInfo* info) const;
|
||||
static Expr* Unserialize(UnserialInfo* info, BroExprTag want = EXPR_ANY);
|
||||
|
@ -191,7 +191,7 @@ public:
|
|||
|
||||
protected:
|
||||
Expr() { type = 0; }
|
||||
Expr(BroExprTag arg_tag);
|
||||
explicit Expr(BroExprTag arg_tag);
|
||||
|
||||
virtual void ExprDescribe(ODesc* d) const = 0;
|
||||
void AddTag(ODesc* d) const;
|
||||
|
@ -215,8 +215,8 @@ protected:
|
|||
|
||||
class NameExpr : public Expr {
|
||||
public:
|
||||
NameExpr(ID* id, bool const_init = false);
|
||||
~NameExpr();
|
||||
explicit NameExpr(ID* id, bool const_init = false);
|
||||
~NameExpr() override;
|
||||
|
||||
ID* Id() const { return id; }
|
||||
|
||||
|
@ -241,8 +241,8 @@ protected:
|
|||
|
||||
class ConstExpr : public Expr {
|
||||
public:
|
||||
ConstExpr(Val* val);
|
||||
~ConstExpr();
|
||||
explicit ConstExpr(Val* val);
|
||||
~ConstExpr() override;
|
||||
|
||||
Val* Value() const { return val; }
|
||||
|
||||
|
@ -278,7 +278,7 @@ protected:
|
|||
UnaryExpr() { op = 0; }
|
||||
|
||||
UnaryExpr(BroExprTag arg_tag, Expr* arg_op);
|
||||
virtual ~UnaryExpr();
|
||||
~UnaryExpr() override;
|
||||
|
||||
void ExprDescribe(ODesc* d) const override;
|
||||
|
||||
|
@ -316,7 +316,7 @@ protected:
|
|||
if ( op1->IsError() || op2->IsError() )
|
||||
SetError();
|
||||
}
|
||||
virtual ~BinaryExpr();
|
||||
~BinaryExpr() override;
|
||||
|
||||
// Returns the expression folded using the given constants.
|
||||
virtual Val* Fold(Val* v1, Val* v2) const;
|
||||
|
@ -350,7 +350,7 @@ protected:
|
|||
|
||||
class CloneExpr : public UnaryExpr {
|
||||
public:
|
||||
CloneExpr(Expr* op);
|
||||
explicit CloneExpr(Expr* op);
|
||||
Val* Eval(Frame* f) const override;
|
||||
|
||||
protected:
|
||||
|
@ -379,7 +379,7 @@ protected:
|
|||
|
||||
class NotExpr : public UnaryExpr {
|
||||
public:
|
||||
NotExpr(Expr* op);
|
||||
explicit NotExpr(Expr* op);
|
||||
|
||||
protected:
|
||||
friend class Expr;
|
||||
|
@ -392,7 +392,7 @@ protected:
|
|||
|
||||
class PosExpr : public UnaryExpr {
|
||||
public:
|
||||
PosExpr(Expr* op);
|
||||
explicit PosExpr(Expr* op);
|
||||
|
||||
protected:
|
||||
friend class Expr;
|
||||
|
@ -405,7 +405,7 @@ protected:
|
|||
|
||||
class NegExpr : public UnaryExpr {
|
||||
public:
|
||||
NegExpr(Expr* op);
|
||||
explicit NegExpr(Expr* op);
|
||||
|
||||
protected:
|
||||
friend class Expr;
|
||||
|
@ -418,7 +418,7 @@ protected:
|
|||
|
||||
class SizeExpr : public UnaryExpr {
|
||||
public:
|
||||
SizeExpr(Expr* op);
|
||||
explicit SizeExpr(Expr* op);
|
||||
Val* Eval(Frame* f) const override;
|
||||
|
||||
protected:
|
||||
|
@ -559,7 +559,7 @@ protected:
|
|||
class CondExpr : public Expr {
|
||||
public:
|
||||
CondExpr(Expr* op1, Expr* op2, Expr* op3);
|
||||
~CondExpr();
|
||||
~CondExpr() override;
|
||||
|
||||
const Expr* Op1() const { return op1; }
|
||||
const Expr* Op2() const { return op2; }
|
||||
|
@ -585,7 +585,7 @@ protected:
|
|||
|
||||
class RefExpr : public UnaryExpr {
|
||||
public:
|
||||
RefExpr(Expr* op);
|
||||
explicit RefExpr(Expr* op);
|
||||
|
||||
void Assign(Frame* f, Val* v, Opcode op = OP_ASSIGN) override;
|
||||
Expr* MakeLvalue() override;
|
||||
|
@ -602,7 +602,7 @@ public:
|
|||
// If val is given, evaluating this expression will always yield the val
|
||||
// yet still perform the assignment. Used for triggers.
|
||||
AssignExpr(Expr* op1, Expr* op2, int is_init, Val* val = 0, attr_list* attrs = 0);
|
||||
virtual ~AssignExpr() { Unref(val); }
|
||||
~AssignExpr() override { Unref(val); }
|
||||
|
||||
Val* Eval(Frame* f) const override;
|
||||
void EvalIntoAggregate(const BroType* t, Val* aggr, Frame* f) const override;
|
||||
|
@ -657,7 +657,7 @@ protected:
|
|||
class FieldExpr : public UnaryExpr {
|
||||
public:
|
||||
FieldExpr(Expr* op, const char* field_name);
|
||||
~FieldExpr();
|
||||
~FieldExpr() override;
|
||||
|
||||
int Field() const { return field; }
|
||||
const char* FieldName() const { return field_name; }
|
||||
|
@ -689,7 +689,7 @@ protected:
|
|||
class HasFieldExpr : public UnaryExpr {
|
||||
public:
|
||||
HasFieldExpr(Expr* op, const char* field_name);
|
||||
~HasFieldExpr();
|
||||
~HasFieldExpr() override;
|
||||
|
||||
const char* FieldName() const { return field_name; }
|
||||
|
||||
|
@ -709,8 +709,8 @@ protected:
|
|||
|
||||
class RecordConstructorExpr : public UnaryExpr {
|
||||
public:
|
||||
RecordConstructorExpr(ListExpr* constructor_list);
|
||||
~RecordConstructorExpr();
|
||||
explicit RecordConstructorExpr(ListExpr* constructor_list);
|
||||
~RecordConstructorExpr() override;
|
||||
|
||||
protected:
|
||||
friend class Expr;
|
||||
|
@ -728,7 +728,7 @@ class TableConstructorExpr : public UnaryExpr {
|
|||
public:
|
||||
TableConstructorExpr(ListExpr* constructor_list, attr_list* attrs,
|
||||
BroType* arg_type = 0);
|
||||
~TableConstructorExpr() { Unref(attrs); }
|
||||
~TableConstructorExpr() override { Unref(attrs); }
|
||||
|
||||
Attributes* Attrs() { return attrs; }
|
||||
|
||||
|
@ -751,7 +751,7 @@ class SetConstructorExpr : public UnaryExpr {
|
|||
public:
|
||||
SetConstructorExpr(ListExpr* constructor_list, attr_list* attrs,
|
||||
BroType* arg_type = 0);
|
||||
~SetConstructorExpr() { Unref(attrs); }
|
||||
~SetConstructorExpr() override { Unref(attrs); }
|
||||
|
||||
Attributes* Attrs() { return attrs; }
|
||||
|
||||
|
@ -772,7 +772,7 @@ protected:
|
|||
|
||||
class VectorConstructorExpr : public UnaryExpr {
|
||||
public:
|
||||
VectorConstructorExpr(ListExpr* constructor_list, BroType* arg_type = 0);
|
||||
explicit VectorConstructorExpr(ListExpr* constructor_list, BroType* arg_type = 0);
|
||||
|
||||
Val* Eval(Frame* f) const override;
|
||||
|
||||
|
@ -824,7 +824,7 @@ protected:
|
|||
class RecordCoerceExpr : public UnaryExpr {
|
||||
public:
|
||||
RecordCoerceExpr(Expr* op, RecordType* r);
|
||||
~RecordCoerceExpr();
|
||||
~RecordCoerceExpr() override;
|
||||
|
||||
protected:
|
||||
friend class Expr;
|
||||
|
@ -844,7 +844,7 @@ protected:
|
|||
class TableCoerceExpr : public UnaryExpr {
|
||||
public:
|
||||
TableCoerceExpr(Expr* op, TableType* r);
|
||||
~TableCoerceExpr();
|
||||
~TableCoerceExpr() override;
|
||||
|
||||
protected:
|
||||
friend class Expr;
|
||||
|
@ -858,7 +858,7 @@ protected:
|
|||
class VectorCoerceExpr : public UnaryExpr {
|
||||
public:
|
||||
VectorCoerceExpr(Expr* op, VectorType* v);
|
||||
~VectorCoerceExpr();
|
||||
~VectorCoerceExpr() override;
|
||||
|
||||
protected:
|
||||
friend class Expr;
|
||||
|
@ -873,7 +873,7 @@ protected:
|
|||
// into a list of individual values.
|
||||
class FlattenExpr : public UnaryExpr {
|
||||
public:
|
||||
FlattenExpr(Expr* op);
|
||||
explicit FlattenExpr(Expr* op);
|
||||
|
||||
protected:
|
||||
friend class Expr;
|
||||
|
@ -892,9 +892,9 @@ class ScheduleTimer : public Timer {
|
|||
public:
|
||||
ScheduleTimer(EventHandlerPtr event, val_list* args, double t,
|
||||
TimerMgr* tmgr);
|
||||
~ScheduleTimer();
|
||||
~ScheduleTimer() override;
|
||||
|
||||
void Dispatch(double t, int is_expire);
|
||||
void Dispatch(double t, int is_expire) override;
|
||||
|
||||
protected:
|
||||
EventHandlerPtr event;
|
||||
|
@ -905,7 +905,7 @@ protected:
|
|||
class ScheduleExpr : public Expr {
|
||||
public:
|
||||
ScheduleExpr(Expr* when, EventExpr* event);
|
||||
~ScheduleExpr();
|
||||
~ScheduleExpr() override;
|
||||
|
||||
int IsPure() const override;
|
||||
|
||||
|
@ -945,7 +945,7 @@ protected:
|
|||
class CallExpr : public Expr {
|
||||
public:
|
||||
CallExpr(Expr* func, ListExpr* args, bool in_hook = false);
|
||||
~CallExpr();
|
||||
~CallExpr() override;
|
||||
|
||||
Expr* Func() const { return func; }
|
||||
ListExpr* Args() const { return args; }
|
||||
|
@ -971,7 +971,7 @@ protected:
|
|||
class EventExpr : public Expr {
|
||||
public:
|
||||
EventExpr(const char* name, ListExpr* args);
|
||||
~EventExpr();
|
||||
~EventExpr() override;
|
||||
|
||||
const char* Name() const { return name.c_str(); }
|
||||
ListExpr* Args() const { return args; }
|
||||
|
@ -997,8 +997,8 @@ protected:
|
|||
class ListExpr : public Expr {
|
||||
public:
|
||||
ListExpr();
|
||||
ListExpr(Expr* e);
|
||||
~ListExpr();
|
||||
explicit ListExpr(Expr* e);
|
||||
~ListExpr() override;
|
||||
|
||||
void Append(Expr* e);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue