Skip to content

Commit

Permalink
Add VL_RESTORER, cleanup and format
Browse files Browse the repository at this point in the history
Signed-off-by: Krzysztof Boronski <[email protected]>
  • Loading branch information
kboronski-ant committed Oct 27, 2023
1 parent c33891a commit 32ac316
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/V3Fork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@
#include "V3Fork.h"

#include "V3AstNodeExpr.h"
#include "V3Global.h"
#include "V3MemberMap.h"
#include "V3String.h"

#include <set>
#include <vector>
Expand Down Expand Up @@ -82,8 +80,7 @@ class ForkDynScopeFrame final {
ForkDynScopeInstance& createInstancePrototype() {
UASSERT_OBJ(!m_instance.initialized(), m_procp, "Dynamic scope already instantiated.");

m_instance.m_classp
= new AstClass{m_procp->fileline(), generateDynScopeClassName()};
m_instance.m_classp = new AstClass{m_procp->fileline(), generateDynScopeClassName()};
m_instance.m_refDTypep
= new AstClassRefDType{m_procp->fileline(), m_instance.m_classp, nullptr};
v3Global.rootp()->typeTablep()->addTypesp(m_instance.m_refDTypep);
Expand Down Expand Up @@ -229,9 +226,7 @@ class ForkDynScopeFrame final {
m_modp->addStmtsp(m_instance.m_classp);
}

string generateDynScopeClassName() {
return "__VDynScope_" + cvtToStr(m_class_id);
}
string generateDynScopeClassName() { return "__VDynScope_" + cvtToStr(m_class_id); }

string generateDynScopeHandleName(const AstNode* fromp) {
return "__VDynScope_" + (!fromp->name().empty() ? (fromp->name() + "_") : "ANON_")
Expand Down Expand Up @@ -624,6 +619,7 @@ class ForkVisitor final : public VNVisitor {
void visit(AstThisRef* nodep) override { return; }
void visit(AstNodeModule* nodep) override {
VL_RESTORER(m_modp);
VL_RESTORER(m_id);
m_modp = nodep;
m_id = 0;
iterateChildren(nodep);
Expand Down

0 comments on commit 32ac316

Please sign in to comment.