Deprecate ID::Attrs(), replace with GetAttrs()

This commit is contained in:
Jon Siwek 2020-05-26 11:34:44 -07:00
parent 28b4206519
commit 2ebc20a164
3 changed files with 9 additions and 4 deletions

View file

@ -102,6 +102,11 @@ public:
void AddAttrs(IntrusivePtr<Attributes> attr);
void RemoveAttr(attr_tag a);
void UpdateValAttrs();
const IntrusivePtr<Attributes>& GetAttrs() const
{ return attrs; }
[[deprecated("Remove in 4.1. Use GetAttrs().")]]
Attributes* Attrs() const { return attrs.get(); }
Attr* FindAttr(attr_tag t) const;

View file

@ -1664,7 +1664,7 @@ IntrusivePtr<Val> InitStmt::Exec(Frame* f, stmt_flow_type& flow) const
break;
case TYPE_TABLE:
v = make_intrusive<TableVal>(cast_intrusive<TableType>(t),
IntrusivePtr{NewRef{}, aggr->Attrs()});
aggr->GetAttrs());
break;
default:
break;

View file

@ -250,8 +250,8 @@ static void make_var(ID* id, IntrusivePtr<BroType> t, init_class c,
}
else if ( t->Tag() == TYPE_TABLE )
aggr = make_intrusive<TableVal>(IntrusivePtr{NewRef{}, t->AsTableType()},
IntrusivePtr{NewRef{}, id->Attrs()});
aggr = make_intrusive<TableVal>(cast_intrusive<TableType>(t),
id->GetAttrs());
else if ( t->Tag() == TYPE_VECTOR )
aggr = make_intrusive<VectorVal>(cast_intrusive<VectorType>(t));
@ -326,7 +326,7 @@ IntrusivePtr<Stmt> add_local(IntrusivePtr<ID> id, IntrusivePtr<BroType> t,
*init->GetLocationInfo() : no_location;
auto name_expr = make_intrusive<NameExpr>(id, dt == VAR_CONST);
auto attrs = id->Attrs() ? id->Attrs()->Attrs() : nullptr;
auto attrs = id->GetAttrs() ? id->GetAttrs()->Attrs() : nullptr;
auto assign_expr = make_intrusive<AssignExpr>(std::move(name_expr),
std::move(init), 0,
nullptr, attrs);