Move Attr to the zeek::detail namespace

This commit is contained in:
Tim Wojtulewicz 2020-05-19 16:06:37 -07:00
parent 54233ce596
commit 60ed29c3b6
21 changed files with 249 additions and 168 deletions

View file

@ -422,7 +422,7 @@ FuncType::FuncType(IntrusivePtr<RecordType> arg_args,
{
const TypeDecl* td = args->FieldDecl(i);
if ( td->attrs && td->attrs->Find(ATTR_DEFAULT) )
if ( td->attrs && td->attrs->Find(zeek::detail::ATTR_DEFAULT) )
has_default_arg = true;
else if ( has_default_arg )
@ -608,7 +608,7 @@ std::optional<FuncType::Prototype> FuncType::FindPrototype(const RecordType& arg
}
TypeDecl::TypeDecl(const char* i, IntrusivePtr<BroType> t,
IntrusivePtr<Attributes> arg_attrs)
IntrusivePtr<zeek::detail::Attributes> arg_attrs)
: type(std::move(t)),
attrs(std::move(arg_attrs)),
id(i)
@ -687,7 +687,7 @@ IntrusivePtr<Val> RecordType::FieldDefault(int field) const
if ( ! td->attrs )
return nullptr;
const auto& def_attr = td->attrs->Find(ATTR_DEFAULT);
const auto& def_attr = td->attrs->Find(zeek::detail::ATTR_DEFAULT);
return def_attr ? def_attr->GetExpr()->Eval(nullptr) : nullptr;
}
@ -807,7 +807,7 @@ IntrusivePtr<TableVal> RecordType::GetRecordFieldsVal(const RecordVal* rv) const
if ( rv )
fv = rv->GetField(i);
bool logged = (fd->attrs && fd->GetAttr(ATTR_LOG) != nullptr);
bool logged = (fd->attrs && fd->GetAttr(zeek::detail::ATTR_LOG) != nullptr);
auto nr = make_intrusive<RecordVal>(record_field);
@ -832,7 +832,7 @@ const char* RecordType::AddFields(const type_decl_list& others,
for ( const auto& td : others )
{
if ( ! td->GetAttr(ATTR_DEFAULT) && ! td->GetAttr(ATTR_OPTIONAL) )
if ( ! td->GetAttr(zeek::detail::ATTR_DEFAULT) && ! td->GetAttr(zeek::detail::ATTR_OPTIONAL) )
return "extension field must be &optional or have &default";
}
@ -843,9 +843,9 @@ const char* RecordType::AddFields(const type_decl_list& others,
if ( add_log_attr )
{
if ( ! td->attrs )
td->attrs = make_intrusive<Attributes>(td->type, true, false);
td->attrs = make_intrusive<zeek::detail::Attributes>(td->type, true, false);
td->attrs->AddAttr(make_intrusive<Attr>(ATTR_LOG));
td->attrs->AddAttr(make_intrusive<zeek::detail::Attr>(zeek::detail::ATTR_LOG));
}
types->push_back(td);
@ -993,7 +993,7 @@ string RecordType::GetFieldDeprecationWarning(int field, bool has_check) const
if ( decl)
{
string result;
if ( const auto& deprecation = decl->GetAttr(ATTR_DEPRECATED) )
if ( const auto& deprecation = decl->GetAttr(zeek::detail::ATTR_DEPRECATED) )
{
auto expr = static_cast<zeek::detail::ConstExpr*>(deprecation->GetExpr().get());
if ( expr )
@ -1559,7 +1559,7 @@ bool same_type(const BroType& arg_t1, const BroType& arg_t2,
return false;
}
bool same_attrs(const Attributes* a1, const Attributes* a2)
bool same_attrs(const zeek::detail::Attributes* a1, const zeek::detail::Attributes* a2)
{
if ( ! a1 )
return (a2 == nullptr);