Support local and protected on typedef (#5460).

This commit is contained in:
Wilson Snyder
2024-10-06 18:08:40 -04:00
parent bc8a332ee8
commit 28ecd8e908
12 changed files with 104 additions and 22 deletions
+15 -6
View File
@@ -85,12 +85,15 @@ private:
"Only rand_mode() and constraint_mode() can have no def");
return;
}
if (const auto varp = VN_CAST(defp, Var)) {
local = varp->isHideLocal();
prot = varp->isHideProtected();
} else if (const auto ftaskp = VN_CAST(defp, NodeFTask)) {
local = ftaskp->isHideLocal();
prot = ftaskp->isHideProtected();
if (const auto anodep = VN_CAST(defp, Var)) {
local = anodep->isHideLocal();
prot = anodep->isHideProtected();
} else if (const auto anodep = VN_CAST(defp, NodeFTask)) {
local = anodep->isHideLocal();
prot = anodep->isHideProtected();
} else if (const auto anodep = VN_CAST(defp, Typedef)) {
local = anodep->isHideLocal();
prot = anodep->isHideProtected();
} else {
nodep->v3fatalSrc("ref to unhandled definition type " << defp->prettyTypeName());
}
@@ -178,6 +181,12 @@ private:
nodep->unlinkFrBack(); // Make non-child
v3Global.rootp()->typeTablep()->addTypesp(nodep);
}
void visit(AstRefDType* nodep) override {
visitIterateNodeDType(nodep);
if (!nodep->typedefp()) return; // Already checked and cleared
classEncapCheck(nodep, nodep->typedefp(), VN_CAST(nodep->classOrPackagep(), Class));
nodep->typedefp(nullptr); // No longer needed
}
void visitIterateNodeDType(AstNodeDType* nodep) {
// Rather than use dtypeChg which may make new nodes, we edit in place,
// as we don't need to preserve any widthMin's, and every dtype with the same width