Skip to content

Commit

Permalink
COWptr/variant fixes (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisDodd committed Dec 5, 2024
1 parent 84df6c9 commit 2b3a17a
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tools/ir-generator/irclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,12 +448,17 @@ IrElement::access_t IrClass::outputCOWfieldrefs(std::ostream &out) const {
if (fld->isStatic) continue;
if (e->access != access) out << indent << (access = e->access);
out << indent << "COWfieldref<" << name << ", ";
const IrClass *cls = fld->type->resolve(fld->clss ? fld->clss->containedIn : nullptr);
if (cls != nullptr && !fld->isInline) out << "const ";
out << fld->type->toString();
if (cls != nullptr && !fld->isInline) out << "*";
out << fld->type->declSuffix() << ", &" << name << "::" << fld->name << "> "
<< fld->name << ";\n";
if (fld->is<IrVariantField>()) {
out << fld->name << "_variant";
} else {
const IrClass *cls = fld->type->resolve(fld->clss ? fld->clss->containedIn
: nullptr);
if (cls != nullptr && !fld->isInline) out << "const ";
out << fld->type->toString();
if (cls != nullptr && !fld->isInline) out << "*";
out << fld->type->declSuffix();
}
out << ", &" << name << "::" << fld->name << "> " << fld->name << ";\n";
}
}
return access;
Expand Down

0 comments on commit 2b3a17a

Please sign in to comment.