mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 10:03:44 +02:00
Internals: Add UASSERT_OBJ macro to replace hand-done ifs. No functional change intended.
This makes it easier to filter out correctly zero code-coverage lines.
This commit is contained in:
+8
-14
@@ -100,10 +100,9 @@ private:
|
||||
// (which at the V3Order stage represent verilog tasks, not to
|
||||
// the CFuncs that V3Order will generate.) So don't check for
|
||||
// collisions in CFuncs.
|
||||
if (nodep->user5p()) {
|
||||
nodep->v3fatalSrc("Node originally inserted below logic vertex "
|
||||
<<static_cast<AstNode*>(nodep->user5p()));
|
||||
}
|
||||
UASSERT_OBJ(!nodep->user5p(), nodep,
|
||||
"Node originally inserted below logic vertex "
|
||||
<<static_cast<AstNode*>(nodep->user5p()));
|
||||
nodep->user5p(const_cast<void*>(reinterpret_cast<const void*>(m_startNodep)));
|
||||
}
|
||||
|
||||
@@ -235,25 +234,20 @@ private:
|
||||
// are no actives-under-actives. In any case, check that we're at
|
||||
// root:
|
||||
markCost(nodep);
|
||||
if (nodep != m_startNodep) {
|
||||
nodep->v3fatalSrc("Multiple actives, or not start node");
|
||||
}
|
||||
UASSERT_OBJ(nodep == m_startNodep, nodep, "Multiple actives, or not start node");
|
||||
}
|
||||
virtual void visit(AstCCall* nodep) {
|
||||
VisitBase vb(this, nodep);
|
||||
iterateChildren(nodep);
|
||||
m_tracingCall = true;
|
||||
iterate(nodep->funcp());
|
||||
if (m_tracingCall) {
|
||||
nodep->v3fatalSrc("visit(AstCFunc) should have cleared m_tracingCall.");
|
||||
}
|
||||
UASSERT_OBJ(!m_tracingCall, nodep, "visit(AstCFunc) should have cleared m_tracingCall.");
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep) {
|
||||
// Don't count a CFunc other than by tracing a call or counting it
|
||||
// from the root
|
||||
if (!m_tracingCall && (nodep != m_startNodep)) {
|
||||
nodep->v3fatalSrc("AstCFunc not under AstCCall, or not start node");
|
||||
}
|
||||
UASSERT_OBJ(m_tracingCall || nodep == m_startNodep, nodep,
|
||||
"AstCFunc not under AstCCall, or not start node");
|
||||
m_tracingCall = false;
|
||||
bool saved_inCFunc = m_inCFunc;
|
||||
m_inCFunc = true;
|
||||
@@ -287,7 +281,7 @@ public:
|
||||
InstrCountDumpVisitor(AstNode* nodep, std::ostream* osp)
|
||||
: m_osp(osp), m_depth(0) {
|
||||
// No check for NULL output, so...
|
||||
if (!osp) nodep->v3fatalSrc("Don't call if not dumping");
|
||||
UASSERT_OBJ(osp, nodep, "Don't call if not dumping");
|
||||
if (nodep) iterate(nodep);
|
||||
}
|
||||
virtual ~InstrCountDumpVisitor() {}
|
||||
|
||||
Reference in New Issue
Block a user