Internals: Add assertions. No functional change intended.

This commit is contained in:
Wilson Snyder 2020-01-25 10:19:59 -05:00
parent d64e6b3f9c
commit eafed88a6e
6 changed files with 10 additions and 4 deletions

View File

@ -104,6 +104,7 @@ private:
//
// V3Combine wouldn't likely be able to combine top-level
// routines anyway, so there's no harm in keeping these static.
UASSERT_OBJ(m_modp, scopep, "Scope not under module");
if (m_modp->isTop()) relativeRefOk = false;
//
// Use absolute refs if this scope is the only instance of the module.

View File

@ -104,6 +104,7 @@ public:
// METHODS
void clear(); // Empty it of all vertices/edges, as if making a new object
void clearColors();
bool empty() const { return m_vertices.empty(); }
V3GraphVertex* verticesBeginp() const { return m_vertices.begin(); }

View File

@ -420,7 +420,7 @@ private:
}
}
virtual void visit(AstCFunc* nodep) VL_OVERRIDE {
//UINFO(4," CCALL "<<nodep<<endl);
//UINFO(4," CFUNC "<<nodep<<endl);
if (!m_tracingCall && !nodep->entryPoint()) return;
m_tracingCall = false;
if (nodep->dpiImport() && !nodep->pure()) {

View File

@ -400,7 +400,7 @@ public:
VSymEnt* getScopeSym(AstScope* nodep) {
NameScopeSymMap::iterator it = m_nameScopeSymMap.find(nodep->name());
UASSERT_OBJ(it != m_nameScopeSymMap.end(), nodep,
"Scope never assigned a symbol entry?");
"Scope never assigned a symbol entry '" << nodep->name() << "'");
return it->second;
}
void implicitOkAdd(AstNodeModule* nodep, const string& varname) {

View File

@ -1036,6 +1036,7 @@ private:
}
virtual void visit(AstVarScope* nodep) VL_OVERRIDE {
// Create links to all input signals
UASSERT_OBJ(m_modp, nodep, "Scope not under module");
if (m_modp->isTop() && nodep->varp()->isNonOutput()) {
OrderVarVertex* varVxp = newVarUserVertex(nodep, WV_STD);
new OrderEdge(&m_graph, m_inputsVxp, varVxp, WEIGHT_INPUT);

View File

@ -136,6 +136,7 @@ public:
// CONSTRUCTORS
TristateGraph() { clear(); }
virtual ~TristateGraph() { clear(); }
VL_UNCOPYABLE(TristateGraph);
private:
// METHODS
@ -212,6 +213,7 @@ private:
public:
// METHODS
bool empty() const { return m_graph.empty(); }
void clear() {
for (V3GraphVertex* itp = m_graph.verticesBeginp(); itp; itp=itp->verticesNextp()) {
TristateVertex* vvertexp = static_cast<TristateVertex*>(itp);
@ -1311,7 +1313,8 @@ class TristateVisitor : public TristateBaseVisitor {
bool origGraphing = m_graphing;
int origUnique = m_unique;
VarMap origLhsmap = m_lhsmap;
TristateGraph origTgraph = m_tgraph;
// Not preserved, needs pointer instead: TristateGraph origTgraph = m_tgraph;
UASSERT_OBJ(m_tgraph.empty(), nodep, "Unsupported: NodeModule under NodeModule");
{
// Clear state
m_graphing = false;
@ -1337,7 +1340,7 @@ class TristateVisitor : public TristateBaseVisitor {
m_graphing = origGraphing;
m_unique = origUnique;
m_lhsmap = origLhsmap;
m_tgraph = origTgraph;
m_tgraph.clear(); // Recursion not supported
}
virtual void visit(AstNodeFTask* nodep) VL_OVERRIDE {