mirror of
https://github.com/verilator/verilator.git
synced 2025-01-22 14:24:18 +00:00
Internals: Code movement, no functional change.
This commit is contained in:
parent
e09f039a36
commit
aa360052a8
@ -1171,6 +1171,12 @@ void AstClass::repairCache() {
|
||||
clearCache();
|
||||
for (AstNode* itemp = membersp(); itemp; itemp = itemp->nextp()) { insertCache(itemp); }
|
||||
}
|
||||
bool AstClass::isClassExtendedFrom(const AstClass* refClassp, const AstClass* baseClassp) {
|
||||
// TAIL RECURSIVE
|
||||
if (!refClassp || !baseClassp) return false;
|
||||
if (refClassp == baseClassp) return true;
|
||||
return isClassExtendedFrom(refClassp->extendsp()->classp(), baseClassp);
|
||||
}
|
||||
void AstClass::dump(std::ostream& str) const {
|
||||
this->AstNode::dump(str);
|
||||
if (isExtended()) str << " [EXT]";
|
||||
|
@ -341,6 +341,9 @@ public:
|
||||
void isExtended(bool flag) { m_extended = flag; }
|
||||
bool isVirtual() const { return m_virtual; }
|
||||
void isVirtual(bool flag) { m_virtual = flag; }
|
||||
// Return true if this class is an extension of base class (SLOW)
|
||||
// Accepts nullptrs
|
||||
static bool isClassExtendedFrom(const AstClass* refClassp, const AstClass* baseClassp);
|
||||
};
|
||||
|
||||
class AstClassExtends final : public AstNode {
|
||||
|
@ -133,7 +133,7 @@ private:
|
||||
const char* how = nullptr;
|
||||
if (local && defClassp && refClassp != defClassp) {
|
||||
how = "'local'";
|
||||
} else if (prot && defClassp && !classExtendedRecurse(refClassp, defClassp)) {
|
||||
} else if (prot && defClassp && !AstClass::isClassExtendedFrom(refClassp, defClassp)) {
|
||||
how = "'protected'";
|
||||
}
|
||||
if (how) {
|
||||
@ -149,12 +149,6 @@ private:
|
||||
}
|
||||
}
|
||||
}
|
||||
static bool classExtendedRecurse(const AstClass* refClassp, const AstClass* defClassp) {
|
||||
// Return true if refClassp is an extends class of defClassp
|
||||
if (!refClassp || !defClassp) return false;
|
||||
if (refClassp == defClassp) return true;
|
||||
return classExtendedRecurse(refClassp->extendsp()->classp(), defClassp);
|
||||
}
|
||||
|
||||
// VISITORS
|
||||
virtual void visit(AstNodeModule* nodep) override {
|
||||
|
Loading…
Reference in New Issue
Block a user