mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
fix for -O gen-C++ dealing with type constants of unnamed compound types
This commit is contained in:
parent
224519c11a
commit
e165e64fa5
3 changed files with 8 additions and 11 deletions
|
@ -299,9 +299,12 @@ void FuncConstInfo::InitializerVals(std::vector<std::string>& ivs) const {
|
|||
}
|
||||
}
|
||||
|
||||
void TypeConstInfo::InitializerVals(std::vector<std::string>& ivs) const {
|
||||
auto& t = tv->GetType()->AsTypeType()->GetType();
|
||||
ivs.emplace_back(Fmt(t->Tag()));
|
||||
TypeConstInfo::TypeConstInfo(CPPCompile* _c, ValPtr v) : CompoundItemInfo(_c, v) {
|
||||
auto tv = v->AsTypeVal();
|
||||
auto t = tv->GetType()->AsTypeType()->GetType();
|
||||
auto gi = c->RegisterType(t);
|
||||
type = c->TypeOffset(t);
|
||||
init_cohort = max(init_cohort, gi->InitCohort() + 1);
|
||||
}
|
||||
|
||||
AttrInfo::AttrInfo(CPPCompile* _c, const AttrPtr& attr) : CompoundItemInfo(_c) {
|
||||
|
|
|
@ -469,12 +469,7 @@ private:
|
|||
|
||||
class TypeConstInfo : public CompoundItemInfo {
|
||||
public:
|
||||
TypeConstInfo(CPPCompile* _c, ValPtr v) : CompoundItemInfo(_c, v), tv(v->AsTypeVal()) {}
|
||||
|
||||
void InitializerVals(std::vector<std::string>& ivs) const override;
|
||||
|
||||
private:
|
||||
TypeVal* tv;
|
||||
TypeConstInfo(CPPCompile* _c, ValPtr v);
|
||||
};
|
||||
|
||||
// Initialization information for single attributes and sets of attributes.
|
||||
|
|
|
@ -154,8 +154,7 @@ void CPP_IndexedInits<T>::Generate(InitsManager* im, std::vector<FuncValPtr>& iv
|
|||
template<class T>
|
||||
void CPP_IndexedInits<T>::Generate(InitsManager* im, std::vector<TypeValPtr>& ivec, int offset,
|
||||
ValElemVec& init_vals) const {
|
||||
auto bt = base_type(static_cast<TypeTag>(init_vals[0]));
|
||||
auto t = make_intrusive<TypeType>(bt);
|
||||
auto t = make_intrusive<TypeType>(im->Types(init_vals[0]));
|
||||
ivec[offset] = make_intrusive<TypeVal>(t);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue