Internals: Experimental cleanup; avoid :: on package symbol tables

This commit is contained in:
Wilson Snyder 2024-09-20 20:39:49 -04:00
parent 5a6f2b661d
commit 774ec42be4
2 changed files with 7 additions and 3 deletions

View File

@ -167,6 +167,10 @@ public:
const std::unique_ptr<std::ofstream> logp{V3File::new_ofstream(filename)};
if (logp->fail()) v3fatal("Can't write " << filename);
std::ostream& os = *logp;
// TODO the symbol table has node pointers which may be
// dangling, as we call deleteTree in these visitors without
// pushing for later deletion (or deleting from the symbol table)
// So, only completely safe to call this when under --debug or --debug-leak.
m_syms.dumpSelf(os);
bool first = true;
for (int samn = 0; samn < SAMN__MAX; ++samn) {
@ -907,8 +911,8 @@ class LinkDotFindVisitor final : public VNVisitor {
} else {
VSymEnt* const upperSymp = m_statep->dunitEntp();
m_scope = nodep->name();
m_curSymp = m_modSymp = m_statep->insertBlock(
upperSymp, nodep->name() + "::", nodep, m_classOrPackagep);
m_curSymp = m_modSymp = m_statep->insertBlock(upperSymp, nodep->name(), nodep,
m_classOrPackagep);
UINFO(9, "New module scope " << m_curSymp << endl);
}
}

View File

@ -69,7 +69,7 @@ public:
os << " se" << cvtToHex(this) << std::setw(0);
os << " fallb=se" << cvtToHex(m_fallbackp);
if (m_symPrefix != "") os << " symPrefix=" << m_symPrefix;
os << " n=" << nodep();
if (nodep()) os << " n=" << nodep();
os << '\n';
if (VL_UNCOVERABLE(!doneSymsr.insert(this).second)) {
os << indent << "| ^ duplicate, so no children printed\n"; // LCOV_EXCL_LINE