Remove redundant 'virtual' keywords from overridden methods

'virtual' is redundant when 'override' is present, so keep only
'override'.

Add t/t_dist_cppstyle.pl to check for this.
This commit is contained in:
Geza Lore
2022-09-16 15:19:38 +01:00
parent d16619fe86
commit 0c70a0dcbf
99 changed files with 4454 additions and 4525 deletions
+14 -14
View File
@@ -75,7 +75,7 @@ public:
, m_osp{osp} {
if (nodep) iterate(nodep);
}
virtual ~InstrCountVisitor() override = default;
~InstrCountVisitor() override = default;
// METHODS
uint32_t instrCount() const { return m_instrCount; }
@@ -117,7 +117,7 @@ private:
}
// VISITORS
virtual void visit(AstNodeSel* nodep) override {
void visit(AstNodeSel* nodep) override {
// This covers both AstArraySel and AstWordSel
//
// If some vector is a bazillion dwords long, and we're selecting 1
@@ -128,7 +128,7 @@ private:
const VisitBase vb{this, nodep};
iterateAndNextNull(nodep->bitp());
}
virtual void visit(AstSel* nodep) override {
void visit(AstSel* nodep) override {
// Similar to AstNodeSel above, a small select into a large vector
// is not expensive. Count the cost of the AstSel itself (scales with
// its width) and the cost of the lsbp() and widthp() nodes, but not
@@ -137,13 +137,13 @@ private:
iterateAndNextNull(nodep->lsbp());
iterateAndNextNull(nodep->widthp());
}
virtual void visit(AstSliceSel* nodep) override { // LCOV_EXCL_LINE
void visit(AstSliceSel* nodep) override { // LCOV_EXCL_LINE
nodep->v3fatalSrc("AstSliceSel unhandled");
}
virtual void visit(AstMemberSel* nodep) override { // LCOV_EXCL_LINE
void visit(AstMemberSel* nodep) override { // LCOV_EXCL_LINE
nodep->v3fatalSrc("AstMemberSel unhandled");
}
virtual void visit(AstConcat* nodep) override {
void visit(AstConcat* nodep) override {
// Nop.
//
// Ignore concat. The problem with counting concat is that when we
@@ -163,7 +163,7 @@ private:
// the widths of the operands (ignored here).
markCost(nodep);
}
virtual void visit(AstNodeIf* nodep) override {
void visit(AstNodeIf* nodep) override {
const VisitBase vb{this, nodep};
iterateAndNextNull(nodep->condp());
const uint32_t savedCount = m_instrCount;
@@ -188,7 +188,7 @@ private:
if (nodep->ifsp()) nodep->ifsp()->user4(0); // Don't dump it
}
}
virtual void visit(AstNodeCond* nodep) override {
void visit(AstNodeCond* nodep) override {
// Just like if/else above, the ternary operator only evaluates
// one of the two expressions, so only count the max.
const VisitBase vb{this, nodep};
@@ -213,7 +213,7 @@ private:
if (nodep->expr2p()) nodep->expr2p()->user4(0); // Don't dump it
}
}
virtual void visit(AstActive* nodep) override {
void visit(AstActive* nodep) override {
// You'd think that the OrderLogicVertex's would be disjoint trees
// of stuff in the AST, but it isn't so: V3Order makes an
// OrderLogicVertex for each ACTIVE, and then also makes an
@@ -229,14 +229,14 @@ private:
markCost(nodep);
UASSERT_OBJ(nodep == m_startNodep, nodep, "Multiple actives, or not start node");
}
virtual void visit(AstNodeCCall* nodep) override {
void visit(AstNodeCCall* nodep) override {
const VisitBase vb{this, nodep};
iterateChildren(nodep);
m_tracingCall = true;
iterate(nodep->funcp());
UASSERT_OBJ(!m_tracingCall, nodep, "visit(AstCFunc) should have cleared m_tracingCall.");
}
virtual void visit(AstCFunc* nodep) override {
void visit(AstCFunc* nodep) override {
// Don't count a CFunc other than by tracing a call or counting it
// from the root
UASSERT_OBJ(m_tracingCall || nodep == m_startNodep, nodep,
@@ -249,7 +249,7 @@ private:
iterateChildren(nodep);
}
}
virtual void visit(AstNode* nodep) override {
void visit(AstNode* nodep) override {
const VisitBase vb{this, nodep};
iterateChildren(nodep);
}
@@ -276,12 +276,12 @@ public:
UASSERT_OBJ(osp, nodep, "Don't call if not dumping");
if (nodep) iterate(nodep);
}
virtual ~InstrCountDumpVisitor() override = default;
~InstrCountDumpVisitor() override = default;
private:
// METHODS
string indent() const { return string(m_depth, ':') + " "; }
virtual void visit(AstNode* nodep) override {
void visit(AstNode* nodep) override {
++m_depth;
if (unsigned costPlus1 = nodep->user4()) {
*m_osp << " " << indent() << "cost " << std::setw(6) << std::left << (costPlus1 - 1)