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 {
|
TypeConstInfo::TypeConstInfo(CPPCompile* _c, ValPtr v) : CompoundItemInfo(_c, v) {
|
||||||
auto& t = tv->GetType()->AsTypeType()->GetType();
|
auto tv = v->AsTypeVal();
|
||||||
ivs.emplace_back(Fmt(t->Tag()));
|
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) {
|
AttrInfo::AttrInfo(CPPCompile* _c, const AttrPtr& attr) : CompoundItemInfo(_c) {
|
||||||
|
|
|
@ -469,12 +469,7 @@ private:
|
||||||
|
|
||||||
class TypeConstInfo : public CompoundItemInfo {
|
class TypeConstInfo : public CompoundItemInfo {
|
||||||
public:
|
public:
|
||||||
TypeConstInfo(CPPCompile* _c, ValPtr v) : CompoundItemInfo(_c, v), tv(v->AsTypeVal()) {}
|
TypeConstInfo(CPPCompile* _c, ValPtr v);
|
||||||
|
|
||||||
void InitializerVals(std::vector<std::string>& ivs) const override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
TypeVal* tv;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Initialization information for single attributes and sets of attributes.
|
// 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>
|
template<class T>
|
||||||
void CPP_IndexedInits<T>::Generate(InitsManager* im, std::vector<TypeValPtr>& ivec, int offset,
|
void CPP_IndexedInits<T>::Generate(InitsManager* im, std::vector<TypeValPtr>& ivec, int offset,
|
||||||
ValElemVec& init_vals) const {
|
ValElemVec& init_vals) const {
|
||||||
auto bt = base_type(static_cast<TypeTag>(init_vals[0]));
|
auto t = make_intrusive<TypeType>(im->Types(init_vals[0]));
|
||||||
auto t = make_intrusive<TypeType>(bt);
|
|
||||||
ivec[offset] = make_intrusive<TypeVal>(t);
|
ivec[offset] = make_intrusive<TypeVal>(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue