Fix unpacked structs under classes (#4102).

This commit is contained in:
Wilson Snyder
2023-04-10 19:40:34 -04:00
parent 3aa013c8db
commit 0307d59c1f
5 changed files with 23 additions and 3 deletions
+2 -1
View File
@@ -178,7 +178,7 @@ private:
void setStructModulep(AstNodeUOrStructDType* const dtypep) {
// Give it a pointer to its package and a final name
dtypep->classOrPackagep(m_modp);
dtypep->classOrPackagep(m_classPackagep ? m_classPackagep : m_modp);
dtypep->name(dtypep->name() + (VN_IS(dtypep, UnionDType) ? "__union" : "__struct")
+ cvtToStr(dtypep->uniqueNum()));
@@ -193,6 +193,7 @@ private:
void visit(AstTypedef* nodep) override {
if (nodep->user1SetOnce()) return;
iterateChildren(nodep);
if (m_classPackagep) m_classPackagep->addStmtsp(nodep->unlinkFrBack());
AstNodeUOrStructDType* const dtypep = VN_CAST(nodep->dtypep(), NodeUOrStructDType);
if (dtypep && !dtypep->packed()) {