mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
fix for -O gen-standalone-C++ initializing locals that have attributes
This commit is contained in:
parent
12098b17d9
commit
53e3ae66db
1 changed files with 11 additions and 1 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