Fix external function declarations with class typedef references (#6433 expanded).
This commit is contained in:
parent
3f7d13b2cf
commit
39a9a00299
|
|
@ -918,15 +918,22 @@ class LinkDotFindVisitor final : public VNVisitor {
|
|||
nodep->isExternDef(true); // So we check there's a matching extern
|
||||
nodep->classOrPackagep()->unlinkFrBack()->deleteTree();
|
||||
// Any "Type::" reference in the function's IO are really "MovedToClass::" references
|
||||
if (nodep->fvarp())
|
||||
nodep->fvarp()->foreach([this, classp](AstClassOrPackageRef* refp) { //
|
||||
if (refp->name() == classp->name() && !refp->paramsp()) {
|
||||
UINFO(9, "Cleaning up external function type for class " << refp);
|
||||
pushDeletep(refp->unlinkFrBack());
|
||||
}
|
||||
});
|
||||
if (nodep->fvarp()) moveExternFuncDeclRefs(nodep->fvarp(), classp);
|
||||
for (AstNode* stmtp = nodep->stmtsp(); stmtp; stmtp = stmtp->nextp()) {
|
||||
if (AstVar* const portp = VN_CAST(stmtp, Var)) {
|
||||
if (portp->isIO()) moveExternFuncDeclRefs(portp, classp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void moveExternFuncDeclRefs(AstNode* nodep, AstClass* classp) {
|
||||
nodep->foreach([this, classp](AstClassOrPackageRef* refp) { //
|
||||
if (refp->name() == classp->name() && !refp->paramsp()) {
|
||||
UINFO(9, "Cleaning up external function type for class " << refp);
|
||||
pushDeletep(refp->unlinkFrBack());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// VISITORS
|
||||
void visit(AstNetlist* nodep) override { // FindVisitor::
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
class uvm_process_guard#(type T=int);
|
||||
T m_context;
|
||||
extern function T get_context();
|
||||
extern function new(T ctxt);
|
||||
endclass
|
||||
|
||||
// When this moves into class, note it's not uvm_process_guard#()::T
|
||||
|
|
@ -15,6 +16,10 @@ function uvm_process_guard::T uvm_process_guard::get_context();
|
|||
return this.m_context;
|
||||
endfunction
|
||||
|
||||
function uvm_process_guard::new(uvm_process_guard::T ctxt);
|
||||
this.m_context = ctxt;
|
||||
endfunction : new
|
||||
|
||||
class uvm_sequence_base;
|
||||
typedef uvm_process_guard#(uvm_sequence_base) m_guard_t;
|
||||
endclass
|
||||
|
|
|
|||
Loading…
Reference in New Issue