Support embedded covergroup member references (Fix #7749) (#8015)

This commit is contained in:
Marco Bartoli
2026-08-01 02:13:53 -04:00
committed by GitHub
parent 56accae45e
commit 7e116ca601
19 changed files with 1044 additions and 71 deletions
+5 -1
View File
@@ -119,7 +119,11 @@ private:
nodep->v3fatalSrc("ref to unhandled definition type " << defp->prettyTypeName());
}
if (local || prot) {
const auto refClassp = VN_CAST(m_modp, Class);
// In case of covergroup, the reference is to the enclosing class, not the covergroup
// itself
const AstClass* refClassp = VN_CAST(m_modp, Class);
if (refClassp && refClassp->isCovergroup())
refClassp = refClassp->covergroupEnclosingClassp();
const char* how = nullptr;
// Inner nested classes can access `local` or `protected` members of their outer class
const auto nestedAccess = [refClassp](const AstClass*, const AstNode* memberp) {