diff --git a/src/V3Ast.h b/src/V3Ast.h index ff783b806..98c0be3cb 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -2374,9 +2374,8 @@ public: virtual AstNodeDType* skipRefToEnump() const = 0; // (Slow) recurses - Structure alignment 1,2,4 or 8 bytes (arrays affect this) virtual int widthAlignBytes() const = 0; - virtual int // (Slow) recurses - Width in bytes rounding up 1,2,4,8,12,... - widthTotalBytes() const = 0; + virtual int widthTotalBytes() const = 0; virtual bool maybePointedTo() const { return true; } // Iff has a non-null refDTypep(), as generic node function virtual AstNodeDType* virtRefDTypep() const { return NULL; } @@ -2533,10 +2532,8 @@ public: virtual V3Hash sameHash() const { return V3Hash(V3Hash(m_refDTypep), V3Hash(msb()), V3Hash(lsb())); } - AstNodeDType* getChildDTypep() const { return childDTypep(); } - AstNodeDType* childDTypep() const { - return VN_CAST(op1p(), NodeDType); - } // op1 = Range of variable + virtual AstNodeDType* getChildDTypep() const { return childDTypep(); } + AstNodeDType* childDTypep() const { return VN_CAST(op1p(), NodeDType); } void childDTypep(AstNodeDType* nodep) { setOp1p(nodep); } virtual AstNodeDType* subDTypep() const { return m_refDTypep ? m_refDTypep : childDTypep(); } void refDTypep(AstNodeDType* nodep) { m_refDTypep = nodep; } diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h index a1b744b4a..32bdcf4e1 100644 --- a/src/V3AstNodes.h +++ b/src/V3AstNodes.h @@ -7774,11 +7774,10 @@ public: virtual bool cleanOut() const { V3ERROR_NA_RETURN(""); } virtual int instrCount() const { return widthInstrs(); } AstNodeDType* getChildDTypep() const { return childDTypep(); } - AstNodeDType* childDTypep() const { - return VN_CAST(op1p(), NodeDType); - } // op1 = Type assigning to - void childDTypep(AstNodeDType* nodep) { setOp1p(nodep); } virtual AstNodeDType* subDTypep() const { return dtypep() ? dtypep() : childDTypep(); } + // op1 = Type assigning to + AstNodeDType* childDTypep() const { return VN_CAST(op1p(), NodeDType); } + void childDTypep(AstNodeDType* nodep) { setOp1p(nodep); } AstNode* itemsp() const { return op2p(); } // op2 = AstPatReplicate, AstPatMember, etc }; class AstPatMember : public AstNodeMath { diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index 0886a7f80..9996f11fb 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -2371,9 +2371,10 @@ private: } virtual void visit(AstEnumDType* nodep) VL_OVERRIDE { iterateChildren(nodep); - AstRefDType* refdtype = VN_CAST(nodep->childDTypep(), RefDType); - if (refdtype && (nodep == refdtype->refDTypep())) - refdtype->v3error("Self-referential enumerated type definition"); + AstRefDType* refdtypep = VN_CAST(nodep->subDTypep(), RefDType); + if (refdtypep && (nodep == refdtypep->subDTypep())) { + refdtypep->v3error("Self-referential enumerated type definition"); + } } virtual void visit(AstEnumItemRef* nodep) VL_OVERRIDE { // EnumItemRef may be under a dot. Should already be resolved.