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