Support unpacked structs (#3802)

This commit is contained in:
Aleksander Kiryk
2022-12-20 19:22:42 -05:00
committed by GitHub
parent c3b4bc85fa
commit c2b09e35f8
43 changed files with 541 additions and 95 deletions
+9
View File
@@ -50,6 +50,11 @@ class EmitCGatherDependencies final : VNVisitor {
if (const AstClassRefDType* const dtypep = VN_CAST(nodep, ClassRefDType)) {
m_dependencies.insert(
EmitCBaseVisitor::prefixNameProtect(dtypep->classp()->classOrPackagep()));
} else if (const AstStructDType* const dtypep = VN_CAST(nodep, StructDType)) {
if (!dtypep->packed()) {
m_dependencies.insert(
EmitCBaseVisitor::prefixNameProtect(dtypep->classOrPackagep()));
}
}
}
void addSelfDependency(const string& selfPointer, AstNode* nodep) {
@@ -92,6 +97,10 @@ class EmitCGatherDependencies final : VNVisitor {
addDTypeDependency(nodep->fromp()->dtypep());
iterateChildrenConst(nodep);
}
void visit(AstStructSel* nodep) override {
addDTypeDependency(nodep->fromp()->dtypep());
iterateChildrenConst(nodep);
}
void visit(AstNodeVarRef* nodep) override {
addSelfDependency(nodep->selfPointer(), nodep->varp());
iterateChildrenConst(nodep);