Add error on missing forward declarations (#6207).

This commit is contained in:
Wilson Snyder
2025-07-26 17:11:35 -04:00
parent d8dbb08a95
commit f3560837ec
16 changed files with 234 additions and 33 deletions
+21
View File
@@ -58,6 +58,27 @@ const VNTypeInfo VNType::typeInfoTable[] = {
std::ostream& operator<<(std::ostream& os, VNType rhs);
//######################################################################
// VFwdType
bool VFwdType::isNodeCompatible(const AstNode* nodep) const {
const AstNode* defp = nodep;
if (const AstTypedef* const adefp = VN_CAST(defp, Typedef)) defp = adefp->subDTypep();
if (const AstNodeDType* const adefp = VN_CAST(defp, NodeDType))
defp = adefp->skipRefToNonRefp();
switch (m_e) {
case VFwdType::NONE: return true; break;
case VFwdType::ENUM: return VN_IS(defp, EnumDType); break;
case VFwdType::STRUCT: return VN_IS(defp, StructDType); break;
case VFwdType::UNION: return VN_IS(defp, UnionDType); break;
case VFwdType::INTERFACE_CLASS: // FALLTHRU // TODO: Over permissive for now
case VFwdType::CLASS: return VN_IS(defp, ClassRefDType) || VN_IS(defp, Class); break;
default: v3fatalSrc("Bad case");
}
VL_UNREACHABLE;
return false; // LCOV_EXCL_LINE
}
//######################################################################
// VSelfPointerText