mirror of
https://github.com/verilator/verilator.git
synced 2026-09-08 02:28:43 +02:00
Internals: clangtidy cleanups. No functional change intended (#7343)
This commit is contained in:
+47
-53
@@ -324,7 +324,7 @@ class ParamProcessor final {
|
||||
const char ch = varp->user3() & 255;
|
||||
string st = cvtToStr(ch);
|
||||
while (index) {
|
||||
st += cvtToStr(char((index % 25) + 'A'));
|
||||
st += cvtToStr(static_cast<char>((index % 25) + 'A'));
|
||||
index /= 26;
|
||||
}
|
||||
return st;
|
||||
@@ -388,7 +388,7 @@ class ParamProcessor final {
|
||||
<< className << " origName=" << origName
|
||||
<< " isSpecialized=" << isSpecialized
|
||||
<< " hasParams=" << (classRefp->paramsp() ? "Y" : "N")
|
||||
<< " classHasGParam=" << classRefp->classp()->hasGParam() << endl);
|
||||
<< " classHasGParam=" << classRefp->classp()->hasGParam());
|
||||
|
||||
if (classRefp->paramsp()) {
|
||||
// ClassRefDType should have been deparameterized (paramsp
|
||||
@@ -459,7 +459,7 @@ class ParamProcessor final {
|
||||
UINFO(4, "Name: " << srcModp->name() << "->" << longname << "->" << newname);
|
||||
return newname;
|
||||
}
|
||||
AstNodeDType* arraySubDTypep(AstNodeDType* nodep) {
|
||||
static AstNodeDType* arraySubDTypep(AstNodeDType* nodep) {
|
||||
// If an unpacked array, return the subDTypep under it
|
||||
if (const AstUnpackArrayDType* const adtypep = VN_CAST(nodep, UnpackArrayDType)) {
|
||||
return adtypep->subDTypep();
|
||||
@@ -472,7 +472,7 @@ class ParamProcessor final {
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
bool isString(AstNodeDType* nodep) {
|
||||
static bool isString(AstNodeDType* nodep) {
|
||||
if (AstBasicDType* const basicp = VN_CAST(nodep->skipRefToNonRefp(), BasicDType))
|
||||
return basicp->isString();
|
||||
return false;
|
||||
@@ -802,7 +802,7 @@ class ParamProcessor final {
|
||||
if (AstVar* const newVarp = VN_CAST(stmtp, Var)) {
|
||||
if (newVarp->name() == varp->name()) {
|
||||
UINFO(9, "VarXRef relink " << varp->name() << " in " << varModp->name()
|
||||
<< " -> " << newIfacep->name() << endl);
|
||||
<< " -> " << newIfacep->name());
|
||||
nodep->varp(newVarp);
|
||||
break;
|
||||
}
|
||||
@@ -874,7 +874,7 @@ class ParamProcessor final {
|
||||
// Phase A: path-based fixup using ledger entries with cellPath.
|
||||
// Phase B: reachable-set fallback for remaining REFDTYPEs.
|
||||
void fixupCrossModuleRefDTypes(AstNodeModule* newModp, AstNodeModule* srcModp,
|
||||
AstNode* ifErrorp, const IfaceRefRefs& ifaceRefRefs) {
|
||||
AstNode* /*ifErrorp*/, const IfaceRefRefs& ifaceRefRefs) {
|
||||
if (!V3LinkDotIfaceCapture::enabled()) return;
|
||||
// Phase A: path-based fixup using ledger entries
|
||||
std::set<AstRefDType*> ledgerFixed;
|
||||
@@ -882,8 +882,8 @@ class ParamProcessor final {
|
||||
// Must match the cloneCellPath used by propagateClone (newname).
|
||||
const string cloneCP = newModp->name();
|
||||
const string srcName = srcModp->name();
|
||||
UINFO(9, "iface capture FIXUP-A: srcName=" << srcName << " cloneCP='" << cloneCP << "'"
|
||||
<< endl);
|
||||
UINFO(9,
|
||||
"iface capture FIXUP-A: srcName=" << srcName << " cloneCP='" << cloneCP << "'");
|
||||
V3LinkDotIfaceCapture::forEach([&](const V3LinkDotIfaceCapture::CapturedEntry& entry) {
|
||||
if (!entry.refp) return;
|
||||
if (entry.cloneCellPath != cloneCP) return;
|
||||
@@ -894,8 +894,7 @@ class ParamProcessor final {
|
||||
AstNodeModule* const correctModp
|
||||
= V3LinkDotIfaceCapture::followCellPath(newModp, entry.cellPath);
|
||||
UINFO(9, " path fixup: " << refp << " cellPath='" << entry.cellPath << "' -> "
|
||||
<< (correctModp ? correctModp->name() : "<null>")
|
||||
<< endl);
|
||||
<< (correctModp ? correctModp->name() : "<null>"));
|
||||
if (!correctModp || correctModp->dead()) return;
|
||||
if (correctModp->parameterizedTemplate()) return;
|
||||
|
||||
@@ -997,14 +996,14 @@ class ParamProcessor final {
|
||||
if (V3LinkDotIfaceCapture::enabled()) {
|
||||
AstCell* const cloneCellp = VN_CAST(ifErrorp, Cell);
|
||||
UINFO(9, "iface capture clone: " << srcModp->prettyNameQ() << " -> "
|
||||
<< newModp->prettyNameQ() << endl);
|
||||
<< newModp->prettyNameQ());
|
||||
// First pass: register clone entries and direct-retarget
|
||||
// REFDTYPEs whose owner won't be cloned later.
|
||||
V3LinkDotIfaceCapture::forEachOwned(
|
||||
srcModp, [&](const V3LinkDotIfaceCapture::CapturedEntry& entry) {
|
||||
if (!entry.refp) return;
|
||||
UINFO(9, "iface capture entry: " << entry.refp << " cellPath='"
|
||||
<< entry.cellPath << "'" << endl);
|
||||
<< entry.cellPath << "'");
|
||||
// Disambiguate via cellPath when cloning the interface
|
||||
// that owns the typedef (matched via typedefOwnerModName).
|
||||
if (cloneCellp && entry.ownerModp != srcModp
|
||||
@@ -1013,7 +1012,7 @@ class ParamProcessor final {
|
||||
"cellPath is empty in entry matched via typedefOwnerModName");
|
||||
if (!cellPathMatchesClone(entry.cellPath, cloneCellp, entry.ownerModp,
|
||||
m_modp)) {
|
||||
UINFO(9, "iface capture skipping (path mismatch)" << endl);
|
||||
UINFO(9, "iface capture skipping (path mismatch)");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1033,8 +1032,7 @@ class ParamProcessor final {
|
||||
// Owner won't be cloned - directly retarget now.
|
||||
if (retargetRefToModule(entry, newModp)) {
|
||||
UINFO(9, "iface capture direct retarget: " << entry.refp << " -> "
|
||||
<< newModp->prettyNameQ()
|
||||
<< endl);
|
||||
<< newModp->prettyNameQ());
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1053,8 +1051,8 @@ class ParamProcessor final {
|
||||
return;
|
||||
}
|
||||
if (retargetRefToModule(entry, newModp)) {
|
||||
UINFO(9, "iface capture clone-entry retarget: "
|
||||
<< entry.refp << " -> " << newModp->prettyNameQ() << endl);
|
||||
UINFO(9, "iface capture clone-entry retarget: " << entry.refp << " -> "
|
||||
<< newModp->prettyNameQ());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1219,7 +1217,7 @@ class ParamProcessor final {
|
||||
if (srcClassp && srcClassp->hasGParam()) {
|
||||
// Specialize if the reference still points to the generic class
|
||||
if (lhsClassp == srcClassp || !lhsClassp) {
|
||||
UINFO(9, "resolveDotToTypedef: specializing " << srcClassp->name() << endl);
|
||||
UINFO(9, "resolveDotToTypedef: specializing " << srcClassp->name());
|
||||
classRefDeparam(classRefp, srcClassp);
|
||||
lhsClassp = VN_CAST(classRefp->classOrPackageSkipp(), Class);
|
||||
}
|
||||
@@ -1333,7 +1331,7 @@ class ParamProcessor final {
|
||||
<< resolvedp->prettyTypeName() << " templateOwner="
|
||||
<< ownerModp->prettyNameQ() << " pin=" << pinp->prettyNameQ()
|
||||
<< " of " << nodep->prettyNameQ()
|
||||
<< " srcMod=" << srcModp->prettyNameQ() << endl);
|
||||
<< " srcMod=" << srcModp->prettyNameQ());
|
||||
}
|
||||
}
|
||||
if (rawTypep && !skipWidthForTemplateStruct) V3Width::widthParamsEdit(rawTypep);
|
||||
@@ -1415,7 +1413,7 @@ class ParamProcessor final {
|
||||
// array) The CellArrayRef is not yet fully linked to an interface type. Skip
|
||||
// interface cleanup for this pin - V3LinkDot will resolve this later. Just
|
||||
// continue to the next pin without error.
|
||||
UINFO(9, "Skipping interface cleanup for CellArrayRef pin: " << pinp << endl);
|
||||
UINFO(9, "Skipping interface cleanup for CellArrayRef pin: " << pinp);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1640,8 +1638,8 @@ class ParamProcessor final {
|
||||
any_overrides = true;
|
||||
}
|
||||
|
||||
UINFO(9, "nodeDeparamCommon: " << srcModp->prettyNameQ() << " overrides=" << any_overrides
|
||||
<< endl);
|
||||
UINFO(9,
|
||||
"nodeDeparamCommon: " << srcModp->prettyNameQ() << " overrides=" << any_overrides);
|
||||
|
||||
AstNodeModule* newModp = nullptr;
|
||||
if (m_hierBlocks.hierSubRun() && m_hierBlocks.isHierBlock(srcModp->origName())) {
|
||||
@@ -1681,8 +1679,7 @@ class ParamProcessor final {
|
||||
}
|
||||
|
||||
const bool cloned = (newModp != srcModp);
|
||||
UINFO(9, "nodeDeparamCommon result: " << newModp->prettyNameQ() << " cloned=" << cloned
|
||||
<< endl);
|
||||
UINFO(9, "nodeDeparamCommon result: " << newModp->prettyNameQ() << " cloned=" << cloned);
|
||||
|
||||
// Link source class to its specialized version for later relinking of method references
|
||||
if (defaultsResolved) srcModp->user4p(newModp);
|
||||
@@ -1762,8 +1759,7 @@ class ParamProcessor final {
|
||||
}
|
||||
if (allOwnParams) {
|
||||
UINFO(5, "ifaceRefDeparam: self-reference pattern detected in "
|
||||
<< ownerIfacep->prettyNameQ() << ", using owner interface"
|
||||
<< endl);
|
||||
<< ownerIfacep->prettyNameQ() << ", using owner interface");
|
||||
V3Stats::addStatSum("Param, Self-reference iface typedefs", 1);
|
||||
nodep->ifacep(ownerIfacep);
|
||||
if (nodep->paramsp()) nodep->paramsp()->unlinkFrBackWithNext()->deleteTree();
|
||||
@@ -1832,8 +1828,8 @@ public:
|
||||
return;
|
||||
}
|
||||
if (retargetRefToModule(entry, correctModp)) {
|
||||
UINFO(9, "retargetIfaceRefs: " << entry.refp << " -> "
|
||||
<< correctModp->prettyNameQ() << endl);
|
||||
UINFO(9,
|
||||
"retargetIfaceRefs: " << entry.refp << " -> " << correctModp->prettyNameQ());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1854,7 +1850,7 @@ public:
|
||||
<< " parentMod=" << (modp ? modp->prettyNameQ() : "'<null>'")
|
||||
<< " parentSomeInstanceName='"
|
||||
<< (modp ? modp->someInstanceName() : string("<null>")) << "'"
|
||||
<< " inputSomeInstanceName='" << someInstanceName << "'" << endl);
|
||||
<< " inputSomeInstanceName='" << someInstanceName << "'");
|
||||
string nodeName = nodep->name();
|
||||
if (AstIfaceRefDType* const ifaceRefp = VN_CAST(nodep, IfaceRefDType)) {
|
||||
if (nodeName.empty()) nodeName = ifaceRefp->cellName();
|
||||
@@ -1885,7 +1881,7 @@ public:
|
||||
UINFO(9, "nodeDeparam SET-SRC-INST srcMod="
|
||||
<< srcModp->prettyNameQ() << " someInstanceName='"
|
||||
<< srcModp->someInstanceName() << "'" << " node=<" << AstNode::nodeAddr(nodep)
|
||||
<< ">" << " nodeType=" << nodep->typeName() << endl);
|
||||
<< ">" << " nodeType=" << nodep->typeName());
|
||||
|
||||
AstNodeModule* newModp = nullptr;
|
||||
if (AstCell* const cellp = VN_CAST(nodep, Cell)) {
|
||||
@@ -1912,7 +1908,7 @@ public:
|
||||
<< (srcModp ? srcModp->someInstanceName() : string("<null>")) << "'"
|
||||
<< " newMod=" << (newModp ? newModp->prettyNameQ() : "'<null>'")
|
||||
<< " newSomeInstanceName='"
|
||||
<< (newModp ? newModp->someInstanceName() : string("<null>")) << "'" << endl);
|
||||
<< (newModp ? newModp->someInstanceName() : string("<null>")) << "'");
|
||||
|
||||
UINFO(8, " Done with orig " << nodep);
|
||||
// if (debug() >= 10)
|
||||
@@ -2077,7 +2073,7 @@ class ParamVisitor final : public VNVisitor {
|
||||
<< " someInstanceName='" << modp->someInstanceName() << "'"
|
||||
<< " hasGParam=" << (modp->hasGParam() ? "yes" : "no")
|
||||
<< " user3p=" << (modp->user3p() ? "set" : "null")
|
||||
<< " dead=" << (modp->dead() ? "yes" : "no") << endl);
|
||||
<< " dead=" << (modp->dead() ? "yes" : "no"));
|
||||
|
||||
// TODO: this really should be an assert, but classes and hier_blocks are
|
||||
// special...
|
||||
@@ -2163,7 +2159,7 @@ class ParamVisitor final : public VNVisitor {
|
||||
}
|
||||
|
||||
// Extract the base reference name from a dotted VarXRef (e.g., "iface.FOO" -> "iface")
|
||||
string getRefBaseName(const AstVarXRef* refp) {
|
||||
static string getRefBaseName(const AstVarXRef* refp) {
|
||||
const string dotted = refp->dotted();
|
||||
if (dotted.empty()) return "";
|
||||
return dotted.substr(0, dotted.find('.'));
|
||||
@@ -2205,9 +2201,8 @@ class ParamVisitor final : public VNVisitor {
|
||||
<< " contextName="
|
||||
<< (contextp ? contextp->prettyNameQ() : "'<null>'")
|
||||
<< " leak=REFDTYPE typedef owner" << " ref=<"
|
||||
<< AstNode::nodeAddr(refp) << ">"
|
||||
<< " refName=" << refp->prettyNameQ()
|
||||
<< " ancestry=" << ancestryOf(refp) << endl);
|
||||
<< AstNode::nodeAddr(refp) << ">" << " refName="
|
||||
<< refp->prettyNameQ() << " ancestry=" << ancestryOf(refp));
|
||||
}
|
||||
}
|
||||
if (refp->refDTypep()) {
|
||||
@@ -2222,9 +2217,8 @@ class ParamVisitor final : public VNVisitor {
|
||||
<< " contextName="
|
||||
<< (contextp ? contextp->prettyNameQ() : "'<null>'")
|
||||
<< " leak=REFDTYPE refDType owner" << " ref=<"
|
||||
<< AstNode::nodeAddr(refp) << ">"
|
||||
<< " refName=" << refp->prettyNameQ()
|
||||
<< " ancestry=" << ancestryOf(refp) << endl);
|
||||
<< AstNode::nodeAddr(refp) << ">" << " refName="
|
||||
<< refp->prettyNameQ() << " ancestry=" << ancestryOf(refp));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -2242,13 +2236,13 @@ class ParamVisitor final : public VNVisitor {
|
||||
<< " contextName=" << (contextp ? contextp->prettyNameQ() : "'<null>'")
|
||||
<< " leak=VARREF target owner" << " ref=<" << AstNode::nodeAddr(varrefp)
|
||||
<< ">" << " var=" << varrefp->prettyNameQ()
|
||||
<< " ancestry=" << ancestryOf(varrefp) << endl);
|
||||
<< " ancestry=" << ancestryOf(varrefp));
|
||||
});
|
||||
|
||||
if (leakCount > 0) {
|
||||
UINFO(9, "TEMPLATE-LEAK summary stage='"
|
||||
<< stage << "' parent=" << parentModp->prettyNameQ() << " template="
|
||||
<< templateModp->prettyNameQ() << " count=" << leakCount << endl);
|
||||
<< stage << "' parent=" << parentModp->prettyNameQ()
|
||||
<< " template=" << templateModp->prettyNameQ() << " count=" << leakCount);
|
||||
}
|
||||
// LCOV_EXCL_STOP
|
||||
}
|
||||
@@ -2361,12 +2355,12 @@ class ParamVisitor final : public VNVisitor {
|
||||
void visit(AstNodeModule* nodep) override {
|
||||
if (nodep->recursiveClone()) nodep->dead(true); // Fake, made for recursive elimination
|
||||
if (nodep->dead()) return; // Marked by LinkDot (and above)
|
||||
UINFO(9, "V3Param: visit module name="
|
||||
<< nodep->prettyNameQ() << " orig='" << nodep->origName()
|
||||
<< "' someInstanceName='" << nodep->someInstanceName()
|
||||
<< "' hasGParam=" << (nodep->hasGParam() ? "yes" : "no")
|
||||
<< " user3p=" << (nodep->user3p() ? "set" : "null")
|
||||
<< " dead=" << (nodep->dead() ? "yes" : "no") << endl);
|
||||
UINFO(9, "V3Param: visit module name=" << nodep->prettyNameQ() << " orig='"
|
||||
<< nodep->origName() << "' someInstanceName='"
|
||||
<< nodep->someInstanceName() << "' hasGParam="
|
||||
<< (nodep->hasGParam() ? "yes" : "no")
|
||||
<< " user3p=" << (nodep->user3p() ? "set" : "null")
|
||||
<< " dead=" << (nodep->dead() ? "yes" : "no"));
|
||||
if (AstClass* const classp = VN_CAST(nodep, Class)) {
|
||||
if (classp->hasGParam()) {
|
||||
// Don't enter into a definition.
|
||||
@@ -2619,7 +2613,7 @@ class ParamVisitor final : public VNVisitor {
|
||||
// In such cases, m_unlinkedTxt won't contain the expected pattern.
|
||||
// Simply skip the replacement - the cell array ref will be resolved later.
|
||||
if (pos == string::npos) {
|
||||
UINFO(9, "Skipping unlinked text replacement for " << nodep << endl);
|
||||
UINFO(9, "Skipping unlinked text replacement for " << nodep);
|
||||
return;
|
||||
}
|
||||
m_unlinkedTxt.replace(pos, replacestr.length(),
|
||||
@@ -2842,15 +2836,15 @@ public:
|
||||
// CONSTRUCTORS
|
||||
explicit ParamTop(AstNetlist* netlistp) {
|
||||
// Relies on modules already being in top-down-order
|
||||
ParamVisitor paramVisitor{m_state /*ref*/, netlistp};
|
||||
const ParamVisitor paramVisitor{m_state /*ref*/, netlistp};
|
||||
|
||||
// Mark classes which cannot be removed because they are still referenced
|
||||
ClassRefUnlinkerVisitor classUnlinkerVisitor{netlistp};
|
||||
const ClassRefUnlinkerVisitor classUnlinkerVisitor{netlistp};
|
||||
|
||||
netlistp->foreach([](AstNodeFTaskRef* ftaskrefp) {
|
||||
AstNodeFTask* ftaskp = ftaskrefp->taskp();
|
||||
if (!ftaskp || !ftaskp->classMethod()) return;
|
||||
string funcName = ftaskp->name();
|
||||
const std::string funcName = ftaskp->name();
|
||||
// Find the nearest containing (ancestor) class for a node.
|
||||
// Uses aboveLoopp() which correctly skips sibling links
|
||||
// (e.g. covergroup classes) to find the true parent.
|
||||
@@ -2890,7 +2884,7 @@ public:
|
||||
}
|
||||
});
|
||||
|
||||
ParamClassRefDTypeRelinkVisitor paramClassDTypeRelinkVisitor{netlistp};
|
||||
const ParamClassRefDTypeRelinkVisitor paramClassDTypeRelinkVisitor{netlistp};
|
||||
|
||||
relinkDots();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user