mirror of
https://github.com/verilator/verilator.git
synced 2026-10-02 16:13:34 +02:00
Fix external function declarations with class typedef references (#6433 expanded).
This commit is contained in:
+14
-7
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user