From 33787c6add3976ca35f9e9065d639b6439318151 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sun, 1 Oct 2023 12:46:35 -0400 Subject: [PATCH] Internals: Fix number nodep cloning, and assert stays consistent (#4528 partial) --- src/V3AstNodeExpr.h | 5 +++++ src/V3Number.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/V3AstNodeExpr.h b/src/V3AstNodeExpr.h index 5b6da8b42..727cdca6e 100644 --- a/src/V3AstNodeExpr.h +++ b/src/V3AstNodeExpr.h @@ -1053,6 +1053,11 @@ public: const AstConst* const sp = static_cast(samep); return num().isCaseEq(sp->num()); } + void cloneRelink() override { m_num.nodep(this); } + const char* broken() const override { + BROKEN_RTN(m_num.nodep() && m_num.nodep() != this); + return nullptr; + } int instrCount() const override { return widthInstrs(); } bool isEqAllOnes() const { return num().isEqAllOnes(width()); } bool isEqAllOnesV() const { return num().isEqAllOnes(widthMinV()); } diff --git a/src/V3Number.h b/src/V3Number.h index e76c854c4..acab8420e 100644 --- a/src/V3Number.h +++ b/src/V3Number.h @@ -357,6 +357,7 @@ class V3Number final { public: void nodep(AstNode* nodep) VL_MT_STABLE; + AstNode* nodep() const VL_MT_SAFE { return m_nodep; } // For debug only FileLine* fileline() const VL_MT_SAFE { return m_fileline; } V3Number& setZero(); V3Number& setQuad(uint64_t value);