diff --git a/src/Stmt.cc b/src/Stmt.cc index f2de940c12..fde3cdc5fa 100644 --- a/src/Stmt.cc +++ b/src/Stmt.cc @@ -606,10 +606,10 @@ SwitchStmt::SwitchStmt(IntrusivePtr index, case_list* arg_cases) { have_exprs = true; - if ( ! is_atomic_type(e->GetType().get()) ) + if ( ! is_atomic_type(e->GetType()) ) e->Error("switch expression must be of an atomic type when cases are expressions"); - if ( ! le->GetType()->AsTypeList()->AllMatch(e->GetType().get(), false) ) + if ( ! le->GetType()->AsTypeList()->AllMatch(e->GetType(), false) ) { le->Error("case expression type differs from switch type", e.get()); continue; diff --git a/src/Type.cc b/src/Type.cc index 3ab5bfee3e..158c8b0ccf 100644 --- a/src/Type.cc +++ b/src/Type.cc @@ -2082,9 +2082,9 @@ IntrusivePtr init_type(Expr* init) nullptr); } -bool is_atomic_type(const BroType* t) +bool is_atomic_type(const BroType& t) { - switch ( t->InternalType() ) { + switch ( t.InternalType() ) { case TYPE_INTERNAL_INT: case TYPE_INTERNAL_UNSIGNED: case TYPE_INTERNAL_DOUBLE: diff --git a/src/Type.h b/src/Type.h index efda5f6e17..92bd2c5ef2 100644 --- a/src/Type.h +++ b/src/Type.h @@ -860,7 +860,11 @@ IntrusivePtr merge_type_list(ListExpr* elements); IntrusivePtr init_type(Expr* init); // Returns true if argument is an atomic type. -bool is_atomic_type(const BroType* t); +bool is_atomic_type(const BroType& t); +inline bool is_atomic_type(const BroType* t) + { return is_atomic_type(*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(BroType* t); diff --git a/src/Val.cc b/src/Val.cc index ce5f0d06bd..6251326ef9 100644 --- a/src/Val.cc +++ b/src/Val.cc @@ -3305,7 +3305,7 @@ bool same_val(const Val* /* v1 */, const Val* /* v2 */) bool is_atomic_val(const Val* v) { - return is_atomic_type(v->GetType().get()); + return is_atomic_type(v->GetType()); } bool same_atomic_val(const Val* v1, const Val* v2)