mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 23:58:20 +00:00
Reworked initialization of globals for -O gen-standalone-C++ code
This commit is contained in:
parent
0700427bac
commit
eb13ff3110
15 changed files with 155 additions and 62 deletions
|
@ -87,7 +87,17 @@ void CPPCompile::GenInitStmt(const InitStmt* init) {
|
|||
continue;
|
||||
}
|
||||
|
||||
Emit("%s = make_intrusive<%s>(cast_intrusive<%s>(%s));", IDName(aggr), type_name, type_type, type_ind);
|
||||
auto aggr_name = IDName(aggr);
|
||||
|
||||
Emit("%s = make_intrusive<%s>(cast_intrusive<%s>(%s));", aggr_name, type_name, type_type, type_ind);
|
||||
|
||||
const auto& attrs = aggr->GetAttrs();
|
||||
if ( ! attrs )
|
||||
continue;
|
||||
|
||||
auto attrs_offset = AttributesOffset(attrs);
|
||||
auto attrs_str = "CPP__Attributes__[" + Fmt(attrs_offset) + "]";
|
||||
Emit("%s->SetAttrs(%s);", aggr_name, attrs_str);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue