Add TypeDef::as() overload to change Struct -> StructA

This commit is contained in:
Michael Davidsaver
2022-11-25 08:03:32 -08:00
parent e381973b3f
commit a4c6540c97
3 changed files with 62 additions and 4 deletions
+11
View File
@@ -336,6 +336,17 @@ Member TypeDef::as(const std::string& name) const
return ret;
}
Member TypeDef::as(TypeCode code, const std::string& name) const
{
Member ret(as(name));
if((code.kind()==Kind::Compound) ^ (ret.code.kind()==Kind::Compound))
throw std::logic_error("as() may change between Compound and non-Compound");
ret.code = code;
return ret;
}
std::shared_ptr<Member> TypeDef::_append_start()
{
if(!top || (top->code.scalarOf()!=TypeCode::Struct && top->code.scalarOf()!=TypeCode::Union))