From b1006157261ea2a5c855270bf3d3e31c006129e7 Mon Sep 17 00:00:00 2001 From: Krzysztof Bieganski Date: Fri, 9 Aug 2024 11:05:52 +0200 Subject: [PATCH] Internals: Relax requirements for `AstClass` iteration methods (#5335) Signed-off-by: Krzysztof Bieganski --- src/V3Ast.h | 2 +- src/V3AstNodeOther.h | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/V3Ast.h b/src/V3Ast.h index 2c748a9dc..ed34ac0dd 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -2503,7 +2503,7 @@ protected: static void dumpJsonStr(std::ostream& os, const std::string& name, const std::string& val); static void dumpJsonPtr(std::ostream& os, const std::string& name, const AstNode* const valp); -private: +protected: void iterateListBackwardsConst(VNVisitorConst& v); // For internal use only. diff --git a/src/V3AstNodeOther.h b/src/V3AstNodeOther.h index 06aee97a0..c4c9dfd94 100644 --- a/src/V3AstNodeOther.h +++ b/src/V3AstNodeOther.h @@ -2353,9 +2353,7 @@ public: extendsp->classp()->foreachMember(f); } for (AstNode* stmtp = stmtsp(); stmtp; stmtp = stmtp->nextp()) { - if (T_Node* memberp = AstNode::privateCast(stmtp)) { - f(this, memberp); - } + if (AstNode::privateTypeTest(stmtp)) f(this, static_cast(stmtp)); } } // Same as above, but stops after first match @@ -2370,8 +2368,8 @@ public: if (extendsp->classp()->existsMember(p)) return true; } for (AstNode* stmtp = stmtsp(); stmtp; stmtp = stmtp->nextp()) { - if (T_Node* memberp = AstNode::privateCast(stmtp)) { - if (p(this, memberp)) return true; + if (AstNode::privateTypeTest(stmtp)) { + if (p(this, static_cast(stmtp))) return true; } } return false;