mirror of
https://github.com/verilator/verilator.git
synced 2026-10-08 02:53:12 +02:00
Static variables of functions are created in the function. When blocks in a function use identical names for static variables, we need to name those variables properly.
This commit is contained in:
+3
-1
@@ -111,6 +111,7 @@ private:
|
||||
|
||||
string dot(const string& a, const string& b) {
|
||||
if (a == "") return b;
|
||||
if (b == "") return a;
|
||||
return a + "__DOT__" + b;
|
||||
}
|
||||
|
||||
@@ -260,7 +261,8 @@ private:
|
||||
void visit(AstVar* nodep) override {
|
||||
// If static variable, move it outside a function.
|
||||
if (nodep->lifetime().isStatic() && m_ftaskp) {
|
||||
const std::string newName = m_ftaskp->name() + "__Vstatic__" + nodep->name();
|
||||
const std::string newName
|
||||
= m_ftaskp->name() + "__Vstatic__" + dot(m_unnamedScope, nodep->name());
|
||||
nodep->name(newName);
|
||||
nodep->unlinkFrBack();
|
||||
m_ftaskp->addHereThisAsNext(nodep);
|
||||
|
||||
Reference in New Issue
Block a user