From c466e634934da2ab4776a6d0ba579f8a5ff78616 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Thu, 27 Feb 2020 13:16:17 -0700 Subject: [PATCH] Expr: other minor initialization cleanup --- src/Expr.cc | 6 +----- src/Expr.h | 8 ++++---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Expr.cc b/src/Expr.cc index 863e263b58..0c4c89c476 100644 --- a/src/Expr.cc +++ b/src/Expr.cc @@ -55,12 +55,8 @@ const char* expr_name(BroExprTag 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); } diff --git a/src/Expr.h b/src/Expr.h index d30b21a146..ed9049652c 100644 --- a/src/Expr.h +++ b/src/Expr.h @@ -16,7 +16,7 @@ using std::string; -typedef enum { +enum BroExprTag : int { EXPR_ANY = -1, EXPR_NAME, EXPR_CONST, EXPR_CLONE, @@ -54,7 +54,7 @@ typedef enum { EXPR_IS, EXPR_INDEX_SLICE_ASSIGN, #define NUM_EXPRS (int(EXPR_INDEX_SLICE_ASSIGN) + 1) -} BroExprTag; +}; extern const char* expr_name(BroExprTag t); @@ -205,7 +205,7 @@ public: virtual TraversalCode Traverse(TraversalCallback* cb) const = 0; protected: - Expr() { type = 0; } + Expr() = default; explicit Expr(BroExprTag arg_tag); virtual void ExprDescribe(ODesc* d) const = 0; @@ -225,7 +225,7 @@ protected: void RuntimeErrorWithCallStack(const std::string& msg) const; BroExprTag tag; - BroType* type; + BroType* type = nullptr; bool paren; };