From 13e88106dab361b7ccbcdb4715f2a37902873367 Mon Sep 17 00:00:00 2001 From: Yutetsu TAKATSUKASA Date: Sun, 13 Dec 2020 16:05:06 +0900 Subject: [PATCH] Internals:Cleanup dpiTypesToStringConverter. No functional change is intended. (#2698) --- src/V3AstNodes.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp index 4a9a48466..0215fb47b 100644 --- a/src/V3AstNodes.cpp +++ b/src/V3AstNodes.cpp @@ -463,21 +463,22 @@ public: } virtual string primitive(const AstVar* varp) const { string type; - if (varp->basicp()->keyword().isDpiUnsignable() && !varp->basicp()->isSigned()) { - type = "unsigned "; - } - type += varp->basicp()->keyword().dpiType(); + const AstBasicDTypeKwd keyword = varp->basicp()->keyword(); + if (keyword.isDpiUnsignable() && !varp->basicp()->isSigned()) type = "unsigned "; + type += keyword.dpiType(); return type; } string convert(const AstVar* varp) const { if (varp->isDpiOpenArray()) { return openArray(varp); - } else if (!varp->basicp()) { - return "UNKNOWN"; - } else if (varp->basicp()->isDpiBitVec() || varp->basicp()->isDpiLogicVec()) { - return bitLogicVector(varp, varp->basicp()->isDpiBitVec()); + } else if (const AstBasicDType* basicp = varp->basicp()) { + if (basicp->isDpiBitVec() || basicp->isDpiLogicVec()) { + return bitLogicVector(varp, basicp->isDpiBitVec()); + } else { + return primitive(varp); + } } else { - return primitive(varp); + return "UNKNOWN"; } } };