Expr: other minor initialization cleanup

This commit is contained in:
Tim Wojtulewicz 2020-02-27 13:16:17 -07:00
parent 8e27cc0a0d
commit c466e63493
2 changed files with 5 additions and 9 deletions

View file

@ -55,12 +55,8 @@ const char* expr_name(BroExprTag t)
return expr_names[int(t)]; return expr_names[int(t)];
} }
Expr::Expr(BroExprTag arg_tag) Expr::Expr(BroExprTag arg_tag) : tag(arg_tag), type(0), paren(0)
{ {
tag = arg_tag;
type = 0;
paren = 0;
SetLocationInfo(&start_location, &end_location); SetLocationInfo(&start_location, &end_location);
} }

View file

@ -16,7 +16,7 @@
using std::string; using std::string;
typedef enum { enum BroExprTag : int {
EXPR_ANY = -1, EXPR_ANY = -1,
EXPR_NAME, EXPR_CONST, EXPR_NAME, EXPR_CONST,
EXPR_CLONE, EXPR_CLONE,
@ -54,7 +54,7 @@ typedef enum {
EXPR_IS, EXPR_IS,
EXPR_INDEX_SLICE_ASSIGN, EXPR_INDEX_SLICE_ASSIGN,
#define NUM_EXPRS (int(EXPR_INDEX_SLICE_ASSIGN) + 1) #define NUM_EXPRS (int(EXPR_INDEX_SLICE_ASSIGN) + 1)
} BroExprTag; };
extern const char* expr_name(BroExprTag t); extern const char* expr_name(BroExprTag t);
@ -205,7 +205,7 @@ public:
virtual TraversalCode Traverse(TraversalCallback* cb) const = 0; virtual TraversalCode Traverse(TraversalCallback* cb) const = 0;
protected: protected:
Expr() { type = 0; } Expr() = default;
explicit Expr(BroExprTag arg_tag); explicit Expr(BroExprTag arg_tag);
virtual void ExprDescribe(ODesc* d) const = 0; virtual void ExprDescribe(ODesc* d) const = 0;
@ -225,7 +225,7 @@ protected:
void RuntimeErrorWithCallStack(const std::string& msg) const; void RuntimeErrorWithCallStack(const std::string& msg) const;
BroExprTag tag; BroExprTag tag;
BroType* type; BroType* type = nullptr;
bool paren; bool paren;
}; };