mirror of
https://github.com/verilator/verilator.git
synced 2025-04-21 12:06:55 +00:00
Internals: Fix constructor style.
This commit is contained in:
parent
528a73a492
commit
0c75d4eaca
@ -203,7 +203,7 @@ public:
|
|||||||
explicit V3GraphVertex(V3Graph* graphp);
|
explicit V3GraphVertex(V3Graph* graphp);
|
||||||
//! Clone copy constructor. Doesn't copy edges or user/userp.
|
//! Clone copy constructor. Doesn't copy edges or user/userp.
|
||||||
virtual V3GraphVertex* clone(V3Graph* graphp) const {
|
virtual V3GraphVertex* clone(V3Graph* graphp) const {
|
||||||
return new V3GraphVertex(graphp, *this);
|
return new V3GraphVertex{graphp, *this};
|
||||||
}
|
}
|
||||||
virtual ~V3GraphVertex() = default;
|
virtual ~V3GraphVertex() = default;
|
||||||
void unlinkEdges(V3Graph* graphp);
|
void unlinkEdges(V3Graph* graphp);
|
||||||
@ -271,6 +271,7 @@ protected:
|
|||||||
friend class V3GraphVertex;
|
friend class V3GraphVertex;
|
||||||
friend class GraphAcyc;
|
friend class GraphAcyc;
|
||||||
friend class GraphAcycEdge;
|
friend class GraphAcycEdge;
|
||||||
|
|
||||||
V3ListEnt<V3GraphEdge*> m_outs; // Next Outbound edge for same vertex (linked list)
|
V3ListEnt<V3GraphEdge*> m_outs; // Next Outbound edge for same vertex (linked list)
|
||||||
V3ListEnt<V3GraphEdge*> m_ins; // Next Inbound edge for same vertex (linked list)
|
V3ListEnt<V3GraphEdge*> m_ins; // Next Inbound edge for same vertex (linked list)
|
||||||
//
|
//
|
||||||
@ -303,7 +304,7 @@ public:
|
|||||||
}
|
}
|
||||||
//! Clone copy constructor. Doesn't copy existing vertices or user/userp.
|
//! Clone copy constructor. Doesn't copy existing vertices or user/userp.
|
||||||
virtual V3GraphEdge* clone(V3Graph* graphp, V3GraphVertex* fromp, V3GraphVertex* top) const {
|
virtual V3GraphEdge* clone(V3Graph* graphp, V3GraphVertex* fromp, V3GraphVertex* top) const {
|
||||||
return new V3GraphEdge(graphp, fromp, top, *this);
|
return new V3GraphEdge{graphp, fromp, top, *this};
|
||||||
}
|
}
|
||||||
virtual ~V3GraphEdge() = default;
|
virtual ~V3GraphEdge() = default;
|
||||||
// METHODS
|
// METHODS
|
||||||
|
@ -233,7 +233,7 @@ public:
|
|||||||
return strp;
|
return strp;
|
||||||
}
|
}
|
||||||
V3Number* newNumber(FileLine* flp, const char* text) {
|
V3Number* newNumber(FileLine* flp, const char* text) {
|
||||||
V3Number* nump = new V3Number(flp, text);
|
V3Number* nump = new V3Number{flp, text};
|
||||||
m_numberps.push_back(nump);
|
m_numberps.push_back(nump);
|
||||||
return nump;
|
return nump;
|
||||||
}
|
}
|
||||||
|
@ -109,14 +109,14 @@ class SliceVisitor final : public VNVisitor {
|
|||||||
+ (!snodep->declRange().littleEndian()
|
+ (!snodep->declRange().littleEndian()
|
||||||
? snodep->declRange().elements() - 1 - offset
|
? snodep->declRange().elements() - 1 - offset
|
||||||
: offset));
|
: offset));
|
||||||
newp = new AstArraySel(nodep->fileline(), snodep->fromp()->cloneTree(false), leOffset);
|
newp = new AstArraySel{nodep->fileline(), snodep->fromp()->cloneTree(false), leOffset};
|
||||||
} else if (VN_IS(nodep, ArraySel) || VN_IS(nodep, NodeVarRef) || VN_IS(nodep, NodeSel)
|
} else if (VN_IS(nodep, ArraySel) || VN_IS(nodep, NodeVarRef) || VN_IS(nodep, NodeSel)
|
||||||
|| VN_IS(nodep, CMethodHard) || VN_IS(nodep, MemberSel)) {
|
|| VN_IS(nodep, CMethodHard) || VN_IS(nodep, MemberSel)) {
|
||||||
UINFO(9, " cloneSel(" << elements << "," << offset << ") " << nodep << endl);
|
UINFO(9, " cloneSel(" << elements << "," << offset << ") " << nodep << endl);
|
||||||
const int leOffset = !arrayp->rangep()->littleEndian()
|
const int leOffset = !arrayp->rangep()->littleEndian()
|
||||||
? arrayp->rangep()->elementsConst() - 1 - offset
|
? arrayp->rangep()->elementsConst() - 1 - offset
|
||||||
: offset;
|
: offset;
|
||||||
newp = new AstArraySel(nodep->fileline(), nodep->cloneTree(false), leOffset);
|
newp = new AstArraySel{nodep->fileline(), nodep->cloneTree(false), leOffset};
|
||||||
} else {
|
} else {
|
||||||
if (!m_assignError) {
|
if (!m_assignError) {
|
||||||
nodep->v3error(nodep->prettyTypeName()
|
nodep->v3error(nodep->prettyTypeName()
|
||||||
@ -189,10 +189,10 @@ class SliceVisitor final : public VNVisitor {
|
|||||||
// EQ(a,b) -> LOGAND(EQ(ARRAYSEL(a,0), ARRAYSEL(b,0)), ...[1])
|
// EQ(a,b) -> LOGAND(EQ(ARRAYSEL(a,0), ARRAYSEL(b,0)), ...[1])
|
||||||
AstNodeBiop* const clonep
|
AstNodeBiop* const clonep
|
||||||
= VN_AS(nodep->cloneType(
|
= VN_AS(nodep->cloneType(
|
||||||
new AstArraySel(nodep->fileline(),
|
new AstArraySel{nodep->fileline(),
|
||||||
nodep->lhsp()->cloneTree(false), index),
|
nodep->lhsp()->cloneTree(false), index},
|
||||||
new AstArraySel(nodep->fileline(),
|
new AstArraySel{nodep->fileline(),
|
||||||
nodep->rhsp()->cloneTree(false), index)),
|
nodep->rhsp()->cloneTree(false), index}),
|
||||||
NodeBiop);
|
NodeBiop);
|
||||||
if (!logp) {
|
if (!logp) {
|
||||||
logp = clonep;
|
logp = clonep;
|
||||||
@ -200,11 +200,11 @@ class SliceVisitor final : public VNVisitor {
|
|||||||
switch (nodep->type()) {
|
switch (nodep->type()) {
|
||||||
case VNType::atEq: // FALLTHRU
|
case VNType::atEq: // FALLTHRU
|
||||||
case VNType::atEqCase:
|
case VNType::atEqCase:
|
||||||
logp = new AstLogAnd(nodep->fileline(), logp, clonep);
|
logp = new AstLogAnd{nodep->fileline(), logp, clonep};
|
||||||
break;
|
break;
|
||||||
case VNType::atNeq: // FALLTHRU
|
case VNType::atNeq: // FALLTHRU
|
||||||
case VNType::atNeqCase:
|
case VNType::atNeqCase:
|
||||||
logp = new AstLogOr(nodep->fileline(), logp, clonep);
|
logp = new AstLogOr{nodep->fileline(), logp, clonep};
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
nodep->v3fatalSrc("Unknown node type processing array slice");
|
nodep->v3fatalSrc("Unknown node type processing array slice");
|
||||||
|
@ -183,7 +183,7 @@ private:
|
|||||||
bool honorExport) {
|
bool honorExport) {
|
||||||
if ((!honorExport || srcp->exported())
|
if ((!honorExport || srcp->exported())
|
||||||
&& !findIdFlat(name)) { // Don't insert over existing entry
|
&& !findIdFlat(name)) { // Don't insert over existing entry
|
||||||
VSymEnt* const symp = new VSymEnt(graphp, srcp);
|
VSymEnt* const symp = new VSymEnt{graphp, srcp};
|
||||||
symp->exported(false); // Can't reimport an import without an export
|
symp->exported(false); // Can't reimport an import without an export
|
||||||
symp->imported(true);
|
symp->imported(true);
|
||||||
reinsert(name, symp);
|
reinsert(name, symp);
|
||||||
@ -248,7 +248,7 @@ public:
|
|||||||
VSymEnt* const subSrcp = it->second;
|
VSymEnt* const subSrcp = it->second;
|
||||||
const AstVar* const varp = VN_CAST(subSrcp->nodep(), Var);
|
const AstVar* const varp = VN_CAST(subSrcp->nodep(), Var);
|
||||||
if (!onlyUnmodportable || (varp && varp->isParam())) {
|
if (!onlyUnmodportable || (varp && varp->isParam())) {
|
||||||
VSymEnt* const subSymp = new VSymEnt(graphp, subSrcp);
|
VSymEnt* const subSymp = new VSymEnt{graphp, subSrcp};
|
||||||
reinsert(name, subSymp);
|
reinsert(name, subSymp);
|
||||||
// And recurse to create children
|
// And recurse to create children
|
||||||
subSymp->importFromIface(graphp, subSrcp);
|
subSymp->importFromIface(graphp, subSrcp);
|
||||||
@ -290,7 +290,7 @@ class VSymGraph final {
|
|||||||
VL_DEFINE_DEBUG_FUNCTIONS;
|
VL_DEFINE_DEBUG_FUNCTIONS;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit VSymGraph(AstNetlist* nodep) { m_symRootp = new VSymEnt(this, nodep); }
|
explicit VSymGraph(AstNetlist* nodep) { m_symRootp = new VSymEnt{this, nodep}; }
|
||||||
~VSymGraph() {
|
~VSymGraph() {
|
||||||
for (const VSymEnt* entp : m_symsp) delete entp;
|
for (const VSymEnt* entp : m_symsp) delete entp;
|
||||||
}
|
}
|
||||||
|
@ -80,10 +80,10 @@ public:
|
|||||||
static AstConst* newIfConstCommitSize(AstConst* nodep) {
|
static AstConst* newIfConstCommitSize(AstConst* nodep) {
|
||||||
if (((nodep->dtypep()->width() != nodep->num().width()) || !nodep->num().sized())
|
if (((nodep->dtypep()->width() != nodep->num().width()) || !nodep->num().sized())
|
||||||
&& !nodep->num().isString()) { // Need to force the number from unsized to sized
|
&& !nodep->num().isString()) { // Need to force the number from unsized to sized
|
||||||
V3Number num(nodep, nodep->dtypep()->width());
|
V3Number num{nodep, nodep->dtypep()->width()};
|
||||||
num.opAssign(nodep->num());
|
num.opAssign(nodep->num());
|
||||||
num.isSigned(nodep->isSigned());
|
num.isSigned(nodep->isSigned());
|
||||||
AstConst* const newp = new AstConst(nodep->fileline(), num);
|
AstConst* const newp = new AstConst{nodep->fileline(), num};
|
||||||
newp->dtypeFrom(nodep);
|
newp->dtypeFrom(nodep);
|
||||||
return newp;
|
return newp;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user