From 2160e4f4ef7a85d4c78384f326bb3851f6b59684 Mon Sep 17 00:00:00 2001 From: Ryszard Rozak Date: Thu, 3 Apr 2025 16:20:29 +0200 Subject: [PATCH] Mark arrayUnpackedElements as const Signed-off-by: Ryszard Rozak --- src/V3AstNodeDType.h | 2 +- src/V3AstNodes.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/V3AstNodeDType.h b/src/V3AstNodeDType.h index 21a16d8cd..36e5f05a2 100644 --- a/src/V3AstNodeDType.h +++ b/src/V3AstNodeDType.h @@ -157,7 +157,7 @@ public: bool generic() const VL_MT_SAFE { return m_generic; } void generic(bool flag) { m_generic = flag; } std::pair dimensions(bool includeBasic); - uint32_t arrayUnpackedElements(); // 1, or total multiplication of all dimensions + uint32_t arrayUnpackedElements() const; // 1, or total multiplication of all dimensions static int uniqueNumInc() { return ++s_uniqueNum; } const char* charIQWN() const { return (isString() ? "N" : isWide() ? "W" : isQuad() ? "Q" : "I"); diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp index 06760ebf6..9ad85e30a 100644 --- a/src/V3AstNodes.cpp +++ b/src/V3AstNodes.cpp @@ -1016,11 +1016,11 @@ AstNodeDType::CTypeRecursed AstNodeDType::cTypeRecurse(bool compound, bool packe return info; } -uint32_t AstNodeDType::arrayUnpackedElements() { +uint32_t AstNodeDType::arrayUnpackedElements() const { uint32_t entries = 1; - for (AstNodeDType* dtypep = this; dtypep;) { + for (const AstNodeDType* dtypep = this; dtypep;) { dtypep = dtypep->skipRefp(); // Skip AstRefDType/AstTypedef, or return same node - if (AstUnpackArrayDType* const adtypep = VN_CAST(dtypep, UnpackArrayDType)) { + if (const AstUnpackArrayDType* const adtypep = VN_CAST(dtypep, UnpackArrayDType)) { entries *= adtypep->elementsConst(); dtypep = adtypep->subDTypep(); } else {