Skip to content

Commit

Permalink
Fix SelExtract visit for ParseRef under AttrOf
Browse files Browse the repository at this point in the history
Signed-off-by: Krzysztof Boronski <[email protected]>
  • Loading branch information
kboronski-ant committed Nov 10, 2023
1 parent 6566e85 commit 3ac1b83
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/V3AstNodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ AstNode* AstArraySel::baseFromp(AstNode* nodep, bool overMembers) {
nodep = VN_AS(nodep, MemberSel)->fromp();
continue;
}
// AstNodeSelPre stashes the associated variable under an ATTROF
// AstNodePreSel stashes the associated variable under an ATTROF
// of VAttrType::VAR_BASE so it isn't constified
else if (VN_IS(nodep, AttrOf)) {
nodep = VN_AS(nodep, AttrOf)->fromp();
Expand Down
16 changes: 15 additions & 1 deletion src/V3LinkDot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3326,7 +3326,19 @@ class LinkDotResolveVisitor final : public VNVisitor {
m_ds.init(m_curSymp);
iterateAndNextNull(nodep->rhsp());
iterateAndNextNull(nodep->thsp());
iterateAndNextNull(nodep->attrp());
}

if (nodep->attrp() != nullptr) {
AstNode* attrp = nodep->attrp()->unlinkFrBack();
VL_DO_DANGLING(attrp->deleteTree(), attrp);
}
AstNode* const basefromp = AstArraySel::baseFromp(nodep, false);
if (VN_IS(basefromp, Replicate)) {
// From {...}[...] syntax in IEEE 2017
if (basefromp) UINFO(1, " Related node: " << basefromp << endl);
} else {
nodep->attrp(new AstAttrOf{nodep->fileline(), VAttrType::VAR_BASE,
basefromp->cloneTree(false)});
}
}
void visit(AstMemberSel* nodep) override {
Expand Down Expand Up @@ -3725,6 +3737,8 @@ class LinkDotResolveVisitor final : public VNVisitor {
iterateChildren(nodep);
}

void visit(AstAttrOf* nodep) override { iterateChildren(nodep); }

void visit(AstNode* nodep) override {
checkNoDot(nodep);
iterateChildren(nodep);
Expand Down
13 changes: 0 additions & 13 deletions src/V3LinkResolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,6 @@ class LinkResolveVisitor final : public VNVisitor {
nodep->scopeNamep(new AstScopeName{nodep->fileline(), false});
}
}
void visit(AstNodePreSel* nodep) override {
if (!nodep->attrp()) {
iterateChildren(nodep);
AstNode* const basefromp = AstArraySel::baseFromp(nodep, false);
if (VN_IS(basefromp, Replicate)) {
// From {...}[...] syntax in IEEE 2017
if (basefromp) UINFO(1, " Related node: " << basefromp << endl);
} else {
nodep->attrp(new AstAttrOf{nodep->fileline(), VAttrType::VAR_BASE,
basefromp->cloneTree(false)});
}
}
}

void visit(AstCaseItem* nodep) override {
// Move default caseItems to the bottom of the list
Expand Down

0 comments on commit 3ac1b83

Please sign in to comment.