Internals: Make some auto more explicit. No functional change.

This commit is contained in:
Wilson Snyder 2025-03-02 17:01:35 -05:00
parent 4bf8f47f59
commit ce211ebceb
8 changed files with 31 additions and 28 deletions

View File

@ -239,7 +239,7 @@ public:
// Make a new AstActive sensitive to the given sentree and return it
AstActive* makeActive(FileLine* const fl, AstSenTree* const senTreep) {
auto* const activep = new AstActive{fl, "", senTreep};
AstActive* const activep = new AstActive{fl, "", senTreep};
activep->sensesStorep(activep->sensesp());
addActive(activep);
return activep;
@ -572,8 +572,8 @@ class ActiveVisitor final : public VNVisitor {
m_clockedProcess = true;
if (nodep->edgeType() != VEdgeType::ET_CHANGED) m_allChanged = false;
if (const auto* const dtypep = nodep->sensp()->dtypep()) {
if (const auto* const basicp = dtypep->basicp()) {
if (const AstNodeDType* const dtypep = nodep->sensp()->dtypep()) {
if (const AstBasicDType* const basicp = dtypep->basicp()) {
if (basicp->isEvent()) nodep->edgeType(VEdgeType::ET_EVENT);
}
}

View File

@ -143,7 +143,7 @@ class AssertVisitor final : public VNVisitor {
}
}
AstSampled* newSampledExpr(AstNodeExpr* nodep) {
const auto sampledp = new AstSampled{nodep->fileline(), nodep};
AstSampled* const sampledp = new AstSampled{nodep->fileline(), nodep};
sampledp->dtypeFrom(nodep);
return sampledp;
}
@ -153,7 +153,7 @@ class AssertVisitor final : public VNVisitor {
nodep->findUInt64DType()};
v3Global.rootp()->dollarUnitPkgAddp()->addStmtsp(m_monitorNumVarp);
}
const auto varrefp = new AstVarRef{nodep->fileline(), m_monitorNumVarp, access};
AstVarRef* const varrefp = new AstVarRef{nodep->fileline(), m_monitorNumVarp, access};
varrefp->classOrPackagep(v3Global.rootp()->dollarUnitPkgAddp());
return varrefp;
}
@ -163,7 +163,7 @@ class AssertVisitor final : public VNVisitor {
nodep->findBitDType()};
v3Global.rootp()->dollarUnitPkgAddp()->addStmtsp(m_monitorOffVarp);
}
const auto varrefp = new AstVarRef{nodep->fileline(), m_monitorOffVarp, access};
AstVarRef* const varrefp = new AstVarRef{nodep->fileline(), m_monitorOffVarp, access};
varrefp->classOrPackagep(v3Global.rootp()->dollarUnitPkgAddp());
return varrefp;
}
@ -528,7 +528,7 @@ class AssertVisitor final : public VNVisitor {
replaceDisplay(nodep, "%%Fatal");
} else if (nodep->displayType() == VDisplayType::DT_MONITOR) {
nodep->displayType(VDisplayType::DT_DISPLAY);
const auto fl = nodep->fileline();
FileLine* const fl = nodep->fileline();
AstNode* monExprsp = nodep->fmtp()->exprsp();
AstSenItem* monSenItemsp = nullptr;
while (monExprsp) {
@ -548,8 +548,8 @@ class AssertVisitor final : public VNVisitor {
AstSenTree* const monSenTree = new AstSenTree{fl, monSenItemsp};
const auto monNum = ++m_monitorNum;
// Where $monitor was we do "__VmonitorNum = N;"
const auto newsetp = new AstAssign{fl, newMonitorNumVarRefp(nodep, VAccess::WRITE),
new AstConst{fl, monNum}};
AstAssign* const newsetp = new AstAssign{
fl, newMonitorNumVarRefp(nodep, VAccess::WRITE), new AstConst{fl, monNum}};
nodep->replaceWith(newsetp);
// Add "always_comb if (__VmonitorOn && __VmonitorNum==N) $display(...);"
AstNode* const stmtsp = nodep;
@ -566,14 +566,14 @@ class AssertVisitor final : public VNVisitor {
} else if (nodep->displayType() == VDisplayType::DT_STROBE) {
nodep->displayType(VDisplayType::DT_DISPLAY);
// Need one-shot
const auto fl = nodep->fileline();
const auto varp
FileLine* const fl = nodep->fileline();
AstVar* const varp
= new AstVar{fl, VVarType::MODULETEMP, "__Vstrobe" + cvtToStr(m_modStrobeNum++),
nodep->findBitDType()};
m_modp->addStmtsp(varp);
// Where $strobe was we do "__Vstrobe = '1;"
const auto newsetp = new AstAssign{fl, new AstVarRef{fl, varp, VAccess::WRITE},
new AstConst{fl, AstConst::BitTrue{}}};
AstAssign* const newsetp = new AstAssign{fl, new AstVarRef{fl, varp, VAccess::WRITE},
new AstConst{fl, AstConst::BitTrue{}}};
nodep->replaceWith(newsetp);
// Add "always_comb if (__Vstrobe) begin $display(...); __Vstrobe = '0; end"
AstNode* const stmtsp = nodep;
@ -587,7 +587,7 @@ class AssertVisitor final : public VNVisitor {
}
}
void visit(AstMonitorOff* nodep) override {
const auto newp
AstAssign* const newp
= new AstAssign{nodep->fileline(), newMonitorOffVarRefp(nodep, VAccess::WRITE),
new AstConst{nodep->fileline(), AstConst::BitTrue{}, nodep->off()}};
nodep->replaceWith(newp);

View File

@ -3064,7 +3064,7 @@ AstAlways* AstAssignW::convertToAlways() {
if (hasTimingControl) {
// If there's a timing control, put the assignment in a fork..join_none. This process won't
// get marked as suspendable and thus will be scheduled normally
auto* forkp = new AstFork{flp, "", bodysp};
AstFork* forkp = new AstFork{flp, "", bodysp};
forkp->joinType(VJoinType::JOIN_NONE);
bodysp = forkp;
}

View File

@ -506,8 +506,9 @@ AstNode* V3Begin::convertToWhile(AstForeach* nodep) {
AstNode* const first_clearp
= new AstAssign{fl, new AstVarRef{fl, first_varp, VAccess::WRITE},
new AstConst{fl, AstConst::BitFalse{}}};
auto* const orp = new AstLogOr{fl, new AstVarRef{fl, first_varp, VAccess::READ},
new AstNeq{fl, new AstConst{fl, 0}, nextp}};
AstLogOr* const orp
= new AstLogOr{fl, new AstVarRef{fl, first_varp, VAccess::READ},
new AstNeq{fl, new AstConst{fl, 0}, nextp}};
AstNode* const whilep = new AstWhile{fl, orp, first_clearp};
first_clearp->addNext(bodyPointp);
AstNode* const ifbodyp

View File

@ -1714,10 +1714,11 @@ class LinkDotFindVisitor final : public VNVisitor {
}
// Type depends on the method used, let V3Width figure it out later
if (nodep->exprsp()) { // Else empty expression and pretend no "with"
const auto indexArgRefp = new AstLambdaArgRef{argFl, name + "__DOT__index", true};
const auto valueArgRefp = new AstLambdaArgRef{argFl, name, false};
const auto newp = new AstWith{nodep->fileline(), indexArgRefp, valueArgRefp,
nodep->exprsp()->unlinkFrBackWithNext()};
AstLambdaArgRef* const indexArgRefp
= new AstLambdaArgRef{argFl, name + "__DOT__index", true};
AstLambdaArgRef* const valueArgRefp = new AstLambdaArgRef{argFl, name, false};
AstWith* const newp = new AstWith{nodep->fileline(), indexArgRefp, valueArgRefp,
nodep->exprsp()->unlinkFrBackWithNext()};
funcrefp->addPinsp(newp);
}
funcrefp->addPinsp(argp);

View File

@ -387,7 +387,7 @@ class LinkParseVisitor final : public VNVisitor {
newfl->warnOff(V3ErrorCode::PROCASSWIRE, true);
// Create a ParseRef to the wire. We cannot use the var as it may be deleted if
// it's a port (see t_var_set_link.v)
auto* const assp = new AstAssign{
AstAssign* const assp = new AstAssign{
newfl, new AstParseRef{newfl, VParseRefExp::PX_TEXT, nodep->name()},
VN_AS(nodep->valuep()->unlinkFrBack(), NodeExpr)};
if (nodep->lifetime().isAutomatic()) {

View File

@ -588,7 +588,7 @@ class WidthVisitor final : public VNVisitor {
return;
}
if (VN_IS(vdtypep, UnpackArrayDType)) {
auto* const newp = new AstPattern{nodep->fileline(), nullptr};
AstPattern* const newp = new AstPattern{nodep->fileline(), nullptr};
patConcatConvertRecurse(newp, nodep);
nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep);
@ -796,7 +796,7 @@ class WidthVisitor final : public VNVisitor {
VL_DO_DANGLING(pushDeletep(nodep), nodep);
return;
} else { // int a[] = {lhs} -> same as '{lhs}
auto* const newp = new AstPattern{
AstPattern* const newp = new AstPattern{
nodep->fileline(),
new AstPatMember{nodep->srcp()->fileline(), nodep->srcp()->unlinkFrBack(),
nullptr, nullptr}};
@ -4192,7 +4192,8 @@ class WidthVisitor final : public VNVisitor {
if (AstQueueDType* const queuep = m_queueDTypeIndexed[indexDTypep]) {
return queuep;
} else {
auto* const newp = new AstQueueDType{indexDTypep->fileline(), indexDTypep, nullptr};
AstQueueDType* const newp
= new AstQueueDType{indexDTypep->fileline(), indexDTypep, nullptr};
v3Global.rootp()->typeTablep()->addTypesp(newp);
m_queueDTypeIndexed[indexDTypep] = newp;
return newp;
@ -5068,7 +5069,7 @@ class WidthVisitor final : public VNVisitor {
iterateCheckAssign(nodep, "Assign RHS", nodep->rhsp(), FINAL, lhsDTypep);
// if (debug()) nodep->dumpTree("- AssignOut: ");
}
if (auto* const controlp = nodep->timingControlp()) {
if (AstNode* const controlp = nodep->timingControlp()) {
if (VN_IS(m_ftaskp, Func)) {
controlp->v3error("Timing controls are not legal in functions. Suggest use a task "
"(IEEE 1800-2023 13.4.4)");

View File

@ -382,8 +382,8 @@ class WidthSelVisitor final : public VNVisitor {
std::string name = (qleftBacknessp ? "sliceBackBack"
: qrightBacknessp ? "sliceFrontBack"
: "slice");
auto* const newp = new AstCMethodHard{nodep->fileline(), fromp, name,
qleftBacknessp ? qleftBacknessp : qleftp};
AstCMethodHard* const newp = new AstCMethodHard{
nodep->fileline(), fromp, name, qleftBacknessp ? qleftBacknessp : qleftp};
newp->addPinsp(qrightBacknessp ? qrightBacknessp : qrightp);
newp->dtypep(ddtypep);
newp->didWidth(true);