forked from github/verilator
Internals: Fix missing relink() and add assert
This commit is contained in:
parent
798d7346cf
commit
80cbf81b3b
@ -1440,6 +1440,13 @@ protected:
|
||||
|
||||
public:
|
||||
VNRelinker() = default;
|
||||
~VNRelinker() {
|
||||
// Relink is needed so m_iterpp's get restored, e.g. can't have:
|
||||
// ->unlinkFrBack(relinker);
|
||||
// if (only_sometimes) relinker.relink(newp);
|
||||
UDEBUGONLY(
|
||||
UASSERT_STATIC(!m_backp, "Active linker must be relink()ed before destruction"););
|
||||
}
|
||||
inline void relink(AstNode* newp);
|
||||
AstNode* oldp() const { return m_oldp; }
|
||||
void dump(std::ostream& str = std::cout) const;
|
||||
@ -1645,7 +1652,6 @@ public:
|
||||
bool brokeExistsAbove() const { return brokeExists() && (m_brokenState >> 7); }
|
||||
bool brokeExistsBelow() const { return brokeExists() && !(m_brokenState >> 7); }
|
||||
// Note: brokeExistsBelow is not quite precise, as it is true for sibling nodes as well
|
||||
bool brokeIterpp() const { return !!m_iterpp; }
|
||||
|
||||
// CONSTRUCTORS
|
||||
virtual ~AstNode() = default;
|
||||
|
@ -146,17 +146,19 @@ private:
|
||||
UASSERT_OBJ(nodep->hasClocked(), nodep, "Should have been converted by V3Sched");
|
||||
UASSERT_OBJ(nodep->stmtsp(), nodep, "Should not have been created if empty");
|
||||
|
||||
VNRelinker relinker;
|
||||
nodep->unlinkFrBack(&relinker);
|
||||
AstNode* const stmtsp = nodep->stmtsp()->unlinkFrBackWithNext();
|
||||
|
||||
// Create 'if' statement, if needed
|
||||
if (!m_lastSenp || !nodep->sensesp()->sameTree(m_lastSenp)) {
|
||||
VNRelinker relinker;
|
||||
nodep->unlinkFrBack(&relinker);
|
||||
clearLastSen();
|
||||
m_lastSenp = nodep->sensesp();
|
||||
// Make a new if statement
|
||||
m_lastIfp = makeActiveIf(m_lastSenp);
|
||||
relinker.relink(m_lastIfp);
|
||||
} else {
|
||||
nodep->unlinkFrBack();
|
||||
}
|
||||
|
||||
// Move statements to if
|
||||
|
Loading…
Reference in New Issue
Block a user