mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 09:08:20 +00:00
fix for tracking identifiers and aggregates when compiling to standalone-C++
This commit is contained in:
parent
b25a844210
commit
18d435ac12
3 changed files with 6 additions and 10 deletions
|
@ -43,16 +43,11 @@ shared_ptr<CPP_InitInfo> CPPCompile::RegisterConstant(const ValPtr& vp, int& con
|
||||||
// render the same.
|
// render the same.
|
||||||
t->Describe(&d);
|
t->Describe(&d);
|
||||||
|
|
||||||
// Likewise, tables that have attributes.
|
|
||||||
if ( t->Tag() == TYPE_TABLE ) {
|
|
||||||
const auto& attrs = v->AsTableVal()->GetAttrs();
|
|
||||||
if ( attrs )
|
|
||||||
attrs->Describe(&d);
|
|
||||||
else
|
|
||||||
d.Add("<no-attrs>");
|
|
||||||
}
|
|
||||||
|
|
||||||
c_desc = d.Description();
|
c_desc = d.Description();
|
||||||
|
|
||||||
|
// Aggregates need to be pointer-unique.
|
||||||
|
if ( IsAggr(t) )
|
||||||
|
c_desc += util::fmt("pointer %p", static_cast<void*>(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto c = constants.find(c_desc);
|
auto c = constants.find(c_desc);
|
||||||
|
|
|
@ -196,6 +196,8 @@ TraversalCode ProfileFunc::PreExpr(const Expr* e) {
|
||||||
auto n = e->AsNameExpr();
|
auto n = e->AsNameExpr();
|
||||||
auto id = n->IdPtr();
|
auto id = n->IdPtr();
|
||||||
|
|
||||||
|
TrackID(id);
|
||||||
|
|
||||||
// Turns out that NameExpr's can be constructed using a
|
// Turns out that NameExpr's can be constructed using a
|
||||||
// different Type* than that of the identifier itself,
|
// different Type* than that of the identifier itself,
|
||||||
// so be sure we track the latter too.
|
// so be sure we track the latter too.
|
||||||
|
|
|
@ -107,7 +107,6 @@ public:
|
||||||
const std::vector<ExprPtr>& Exprs() const { return exprs; }
|
const std::vector<ExprPtr>& Exprs() const { return exprs; }
|
||||||
const std::vector<const LambdaExpr*>& Lambdas() const { return lambdas; }
|
const std::vector<const LambdaExpr*>& Lambdas() const { return lambdas; }
|
||||||
const std::vector<const ConstExpr*>& Constants() const { return constants; }
|
const std::vector<const ConstExpr*>& Constants() const { return constants; }
|
||||||
const IDSet& UnorderedIdentifiers() const { return ids; }
|
|
||||||
const std::vector<IDPtr>& OrderedIdentifiers() const { return ordered_ids; }
|
const std::vector<IDPtr>& OrderedIdentifiers() const { return ordered_ids; }
|
||||||
const TypeSet& UnorderedTypes() const { return types; }
|
const TypeSet& UnorderedTypes() const { return types; }
|
||||||
const std::vector<const Type*>& OrderedTypes() const { return ordered_types; }
|
const std::vector<const Type*>& OrderedTypes() const { return ordered_types; }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue