Internals: Function/variable renames. No functional change.

This commit is contained in:
Wilson Snyder 2024-12-14 12:49:42 -05:00
parent 80b2fa3583
commit 6aa7123a8c

View File

@ -2400,66 +2400,62 @@ class LinkDotResolveVisitor final : public VNVisitor {
} }
return classSymp; return classSymp;
} }
void importImplementsClass(AstClass* implementsClassp, VSymEnt* interfaceSymp, void importDerivedClass(AstClass* derivedClassp, VSymEnt* baseSymp, AstClass* baseClassp) {
AstClass* baseClassp) {
// Also used for standard 'extends' from a base class // Also used for standard 'extends' from a base class
UINFO(8, indent() << "importImplementsClass to " << implementsClassp << " from " UINFO(8, indent() << "importDerivedClass to " << derivedClassp << " from " << baseClassp
<< baseClassp << endl); << endl);
for (VSymEnt::const_iterator it = interfaceSymp->begin(); it != interfaceSymp->end(); for (VSymEnt::const_iterator it = baseSymp->begin(); it != baseSymp->end(); ++it) {
++it) { if (AstNode* baseSubp = it->second->nodep()) {
if (AstNode* interfaceSubp = it->second->nodep()) { UINFO(8, indent() << " SymFunc " << baseSubp << endl);
UINFO(8, indent() << " SymFunc " << interfaceSubp << endl);
const string impOrExtends const string impOrExtends
= baseClassp->isInterfaceClass() ? " implements " : " extends "; = baseClassp->isInterfaceClass() ? " implements " : " extends ";
if (VN_IS(interfaceSubp, NodeFTask)) { if (VN_IS(baseSubp, NodeFTask)) {
const VSymEnt* const foundp = m_curSymp->findIdFlat(interfaceSubp->name()); const VSymEnt* const foundp = m_curSymp->findIdFlat(baseSubp->name());
const AstNodeFTask* const interfaceFuncp = VN_CAST(interfaceSubp, NodeFTask); const AstNodeFTask* const baseFuncp = VN_CAST(baseSubp, NodeFTask);
if (!interfaceFuncp || !interfaceFuncp->pureVirtual()) continue; if (!baseFuncp || !baseFuncp->pureVirtual()) continue;
bool existsInChild = foundp && !foundp->imported(); bool existsInDerived = foundp && !foundp->imported();
if (!existsInChild && !implementsClassp->isInterfaceClass()) { if (!existsInDerived && !derivedClassp->isInterfaceClass()) {
implementsClassp->v3error( derivedClassp->v3error(
"Class " << implementsClassp->prettyNameQ() << impOrExtends "Class " << derivedClassp->prettyNameQ() << impOrExtends
<< baseClassp->prettyNameQ() << baseClassp->prettyNameQ()
<< " but is missing implementation for " << " but is missing implementation for "
<< interfaceSubp->prettyNameQ() << " (IEEE 1800-2023 8.26)\n" << baseSubp->prettyNameQ() << " (IEEE 1800-2023 8.26)\n"
<< implementsClassp->warnContextPrimary() << '\n' << derivedClassp->warnContextPrimary() << '\n'
<< interfaceSubp->warnOther() << baseSubp->warnOther()
<< "... Location of interface class's function\n" << "... Location of interface class's function\n"
<< interfaceSubp->warnContextSecondary()); << baseSubp->warnContextSecondary());
} }
const auto itn = m_ifClassImpNames.find(interfaceSubp->name()); const auto itn = m_ifClassImpNames.find(baseSubp->name());
if (!existsInChild && itn != m_ifClassImpNames.end() if (!existsInDerived && itn != m_ifClassImpNames.end()
&& itn->second != interfaceSubp) { // Not exact same function from diamond && itn->second != baseSubp) { // Not exact same function from diamond
implementsClassp->v3error( derivedClassp->v3error(
"Class " << implementsClassp->prettyNameQ() << impOrExtends "Class " << derivedClassp->prettyNameQ() << impOrExtends
<< baseClassp->prettyNameQ() << baseClassp->prettyNameQ()
<< " but missing inheritance conflict resolution for " << " but missing inheritance conflict resolution for "
<< interfaceSubp->prettyNameQ() << baseSubp->prettyNameQ() << " (IEEE 1800-2023 8.26.6.2)\n"
<< " (IEEE 1800-2023 8.26.6.2)\n" << derivedClassp->warnContextPrimary() << '\n'
<< implementsClassp->warnContextPrimary() << '\n' << baseSubp->warnOther()
<< interfaceSubp->warnOther()
<< "... Location of interface class's function\n" << "... Location of interface class's function\n"
<< interfaceSubp->warnContextSecondary()); << baseSubp->warnContextSecondary());
} }
m_ifClassImpNames.emplace(interfaceSubp->name(), interfaceSubp); m_ifClassImpNames.emplace(baseSubp->name(), baseSubp);
} }
if (VN_IS(interfaceSubp, Constraint)) { if (VN_IS(baseSubp, Constraint)) {
const VSymEnt* const foundp = m_curSymp->findIdFlat(interfaceSubp->name()); const VSymEnt* const foundp = m_curSymp->findIdFlat(baseSubp->name());
const AstConstraint* const interfaceFuncp = VN_CAST(interfaceSubp, Constraint); const AstConstraint* const baseFuncp = VN_CAST(baseSubp, Constraint);
if (!interfaceFuncp || !interfaceFuncp->isKwdPure()) continue; if (!baseFuncp || !baseFuncp->isKwdPure()) continue;
bool existsInChild = foundp && !foundp->imported(); bool existsInDerived = foundp && !foundp->imported();
if (!existsInChild && !implementsClassp->isInterfaceClass() if (!existsInDerived && !derivedClassp->isInterfaceClass()
&& !implementsClassp->isVirtual()) { && !derivedClassp->isVirtual()) {
implementsClassp->v3error( derivedClassp->v3error(
"Class " << implementsClassp->prettyNameQ() << impOrExtends "Class " << derivedClassp->prettyNameQ() << impOrExtends
<< baseClassp->prettyNameQ() << baseClassp->prettyNameQ()
<< " but is missing constraint implementation for " << " but is missing constraint implementation for "
<< interfaceSubp->prettyNameQ() << baseSubp->prettyNameQ() << " (IEEE 1800-2023 18.5.2)\n"
<< " (IEEE 1800-2023 18.5.2)\n" << derivedClassp->warnContextPrimary() << '\n'
<< implementsClassp->warnContextPrimary() << '\n' << baseSubp->warnOther()
<< interfaceSubp->warnOther()
<< "... Location of interface class's pure constraint\n" << "... Location of interface class's pure constraint\n"
<< interfaceSubp->warnContextSecondary()); << baseSubp->warnContextSecondary());
} }
} }
} }
@ -2468,7 +2464,7 @@ class LinkDotResolveVisitor final : public VNVisitor {
void importSymbolsFromExtended(AstClass* const nodep, AstClassExtends* const cextp) { void importSymbolsFromExtended(AstClass* const nodep, AstClassExtends* const cextp) {
AstClass* const baseClassp = cextp->classp(); AstClass* const baseClassp = cextp->classp();
VSymEnt* const srcp = m_statep->getNodeSym(baseClassp); VSymEnt* const srcp = m_statep->getNodeSym(baseClassp);
importImplementsClass(nodep, srcp, baseClassp); importDerivedClass(nodep, srcp, baseClassp);
if (!cextp->isImplements()) m_curSymp->importFromClass(m_statep->symsp(), srcp); if (!cextp->isImplements()) m_curSymp->importFromClass(m_statep->symsp(), srcp);
} }
void classExtendImport(AstClass* nodep) { void classExtendImport(AstClass* nodep) {