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:
Johanna Amann 2018-03-16 22:14:22 -07:00
parent 1f2bf50b49
commit 6d612ced3d
173 changed files with 1052 additions and 1046 deletions

View file

@ -22,9 +22,9 @@ public:
enum Kind { BRO_FUNC, BUILTIN_FUNC };
Func(Kind arg_kind);
explicit Func(Kind arg_kind);
virtual ~Func();
~Func() override;
virtual int IsPure() const = 0;
function_flavor Flavor() const { return FType()->Flavor(); }
@ -56,7 +56,7 @@ public:
const char* Name() const { return name.c_str(); }
void SetName(const char* arg_name) { name = arg_name; }
virtual void Describe(ODesc* d) const = 0;
void Describe(ODesc* d) const override = 0;
virtual void DescribeDebug(ODesc* d, const val_list* args) const;
// This (un-)serializes only a single body (as given in SerialInfo).
@ -90,7 +90,7 @@ protected:
class BroFunc : public Func {
public:
BroFunc(ID* id, Stmt* body, id_list* inits, int frame_size, int priority);
~BroFunc();
~BroFunc() override;
int IsPure() const override;
Val* Call(val_list* args, Frame* parent) const override;
@ -116,7 +116,7 @@ typedef Val* (*built_in_func)(Frame* frame, val_list* args);
class BuiltinFunc : public Func {
public:
BuiltinFunc(built_in_func func, const char* name, int is_pure);
~BuiltinFunc();
~BuiltinFunc() override;
int IsPure() const override;
Val* Call(val_list* args, Frame* parent) const override;