UID, ..: un-inline methods to reduce header dependencies

Only 1% build time speedup, but still, it declutters the headers a bit.

Before this patch:

 2565.17user 141.83system 2:25.46elapsed 1860%CPU (0avgtext+0avgdata 1489076maxresident)k
 72576inputs+9130920outputs (1667major+49400430minor)pagefaults 0swaps

After this patch:

 2537.19user 142.94system 2:26.90elapsed 1824%CPU (0avgtext+0avgdata 1434268maxresident)k
 16240inputs+8887152outputs (1931major+48728888minor)pagefaults 0swaps
This commit is contained in:
Max Kellermann 2020-02-02 16:29:27 +01:00
parent 0db61f3094
commit 6a815b4b06
38 changed files with 348 additions and 211 deletions

View file

@ -3,12 +3,14 @@
#include "zeek-config.h"
#include "ID.h"
#include "Attr.h"
#include "Desc.h"
#include "Expr.h"
#include "Dict.h"
#include "EventRegistry.h"
#include "Func.h"
#include "Scope.h"
#include "Type.h"
#include "File.h"
#include "Scope.h"
#include "Traverse.h"
@ -56,6 +58,11 @@ string ID::ModuleName() const
return extract_module_name(name);
}
void ID::SetType(BroType* t)
{
Unref(type); type = t;
}
void ID::ClearVal()
{
if ( ! weak_ref )
@ -148,6 +155,11 @@ void ID::SetVal(Expr* ev, init_class c)
EvalFunc(a->AttrExpr(), ev);
}
bool ID::IsRedefinable() const
{
return FindAttr(ATTR_REDEF) != 0;
}
void ID::SetAttrs(Attributes* a)
{
Unref(attrs);
@ -194,6 +206,16 @@ void ID::UpdateValAttrs()
}
}
Attr* ID::FindAttr(attr_tag t) const
{
return attrs ? attrs->FindAttr(t) : 0;
}
bool ID::IsDeprecated() const
{
return FindAttr(ATTR_DEPRECATED) != 0;
}
void ID::MakeDeprecated(Expr* deprecation)
{
if ( IsDeprecated() )