mirror of
https://github.com/verilator/verilator.git
synced 2025-05-01 13:06:56 +00:00
Internals: Pass FileLine to findDotted() for error location (#2455)
* Pass FileLine so that findDotted() will be able to tell the error location though it is not used yet. * reorder the parameter order. No functional change is intended.
This commit is contained in:
parent
30600bf1a3
commit
8291ef6537
@ -539,8 +539,8 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VSymEnt* findDotted(VSymEnt* lookupSymp, const string& dotname, string& baddot,
|
VSymEnt* findDotted(FileLine* /*refLocationp*/, VSymEnt* lookupSymp, const string& dotname,
|
||||||
VSymEnt*& okSymp) {
|
string& baddot, VSymEnt*& okSymp) {
|
||||||
// Given a dotted hierarchy name, return where in scope it is
|
// Given a dotted hierarchy name, return where in scope it is
|
||||||
// Note when dotname=="" we just fall through and return lookupSymp
|
// Note when dotname=="" we just fall through and return lookupSymp
|
||||||
UINFO(8, " dottedFind se" << cvtToHex(lookupSymp) << " '" << dotname << "'" << endl);
|
UINFO(8, " dottedFind se" << cvtToHex(lookupSymp) << " '" << dotname << "'" << endl);
|
||||||
@ -875,7 +875,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
|||||||
string scope = origname.substr(0, pos);
|
string scope = origname.substr(0, pos);
|
||||||
string baddot;
|
string baddot;
|
||||||
VSymEnt* okSymp;
|
VSymEnt* okSymp;
|
||||||
aboveSymp = m_statep->findDotted(aboveSymp, scope, baddot, okSymp);
|
aboveSymp = m_statep->findDotted(nodep->fileline(), aboveSymp, scope, baddot, okSymp);
|
||||||
UASSERT_OBJ(aboveSymp, nodep,
|
UASSERT_OBJ(aboveSymp, nodep,
|
||||||
"Can't find cell insertion point at " << AstNode::prettyNameQ(baddot)
|
"Can't find cell insertion point at " << AstNode::prettyNameQ(baddot)
|
||||||
<< " in: " << nodep->prettyNameQ());
|
<< " in: " << nodep->prettyNameQ());
|
||||||
@ -906,7 +906,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
|||||||
string ident = dottedname.substr(pos + strlen("__DOT__"));
|
string ident = dottedname.substr(pos + strlen("__DOT__"));
|
||||||
string baddot;
|
string baddot;
|
||||||
VSymEnt* okSymp;
|
VSymEnt* okSymp;
|
||||||
aboveSymp = m_statep->findDotted(aboveSymp, dotted, baddot, okSymp);
|
aboveSymp = m_statep->findDotted(nodep->fileline(), aboveSymp, dotted, baddot, okSymp);
|
||||||
UASSERT_OBJ(aboveSymp, nodep,
|
UASSERT_OBJ(aboveSymp, nodep,
|
||||||
"Can't find cellinline insertion point at "
|
"Can't find cellinline insertion point at "
|
||||||
<< AstNode::prettyNameQ(baddot) << " in: " << nodep->prettyNameQ());
|
<< AstNode::prettyNameQ(baddot) << " in: " << nodep->prettyNameQ());
|
||||||
@ -1106,7 +1106,8 @@ class LinkDotFindVisitor : public AstNVisitor {
|
|||||||
= new AstVar(nodep->fileline(), AstVarType(AstVarType::GPARAM),
|
= new AstVar(nodep->fileline(), AstVarType(AstVarType::GPARAM),
|
||||||
nodep->name(), nodep);
|
nodep->name(), nodep);
|
||||||
string svalue = v3Global.opt.parameter(nodep->name());
|
string svalue = v3Global.opt.parameter(nodep->name());
|
||||||
if (AstNode* valuep = AstConst::parseParamLiteral(nodep->fileline(), svalue)) {
|
if (AstNode* valuep
|
||||||
|
= AstConst::parseParamLiteral(nodep->fileline(), svalue)) {
|
||||||
newp->valuep(valuep);
|
newp->valuep(valuep);
|
||||||
UINFO(9, " replace parameter " << nodep << endl);
|
UINFO(9, " replace parameter " << nodep << endl);
|
||||||
UINFO(9, " with " << newp << endl);
|
UINFO(9, " with " << newp << endl);
|
||||||
@ -1459,13 +1460,15 @@ class LinkDotScopeVisitor : public AstNVisitor {
|
|||||||
string ifcellname = dtypep->cellName();
|
string ifcellname = dtypep->cellName();
|
||||||
string baddot;
|
string baddot;
|
||||||
VSymEnt* okSymp;
|
VSymEnt* okSymp;
|
||||||
VSymEnt* cellSymp = m_statep->findDotted(m_modSymp, ifcellname, baddot, okSymp);
|
VSymEnt* cellSymp = m_statep->findDotted(nodep->fileline(), m_modSymp, ifcellname,
|
||||||
|
baddot, okSymp);
|
||||||
UASSERT_OBJ(cellSymp, nodep,
|
UASSERT_OBJ(cellSymp, nodep,
|
||||||
"No symbol for interface cell: " << nodep->prettyNameQ(ifcellname));
|
"No symbol for interface cell: " << nodep->prettyNameQ(ifcellname));
|
||||||
UINFO(5, " Found interface cell: se" << cvtToHex(cellSymp) << " "
|
UINFO(5, " Found interface cell: se" << cvtToHex(cellSymp) << " "
|
||||||
<< cellSymp->nodep() << endl);
|
<< cellSymp->nodep() << endl);
|
||||||
if (dtypep->modportName() != "") {
|
if (dtypep->modportName() != "") {
|
||||||
VSymEnt* mpSymp = m_statep->findDotted(m_modSymp, ifcellname, baddot, okSymp);
|
VSymEnt* mpSymp = m_statep->findDotted(nodep->fileline(), m_modSymp,
|
||||||
|
ifcellname, baddot, okSymp);
|
||||||
UASSERT_OBJ(mpSymp, nodep,
|
UASSERT_OBJ(mpSymp, nodep,
|
||||||
"No symbol for interface modport: "
|
"No symbol for interface modport: "
|
||||||
<< nodep->prettyNameQ(dtypep->modportName()));
|
<< nodep->prettyNameQ(dtypep->modportName()));
|
||||||
@ -1514,7 +1517,8 @@ class LinkDotScopeVisitor : public AstNVisitor {
|
|||||||
= refp ? refp->name() : (inl.size() ? (inl + xrefp->name()) : xrefp->name());
|
= refp ? refp->name() : (inl.size() ? (inl + xrefp->name()) : xrefp->name());
|
||||||
string baddot;
|
string baddot;
|
||||||
VSymEnt* okSymp;
|
VSymEnt* okSymp;
|
||||||
symp = m_statep->findDotted(m_modSymp, scopename, baddot, okSymp);
|
symp = m_statep->findDotted(nodep->rhsp()->fileline(), m_modSymp, scopename,
|
||||||
|
baddot, okSymp);
|
||||||
if (inl == "") break;
|
if (inl == "") break;
|
||||||
inl = LinkDotState::removeLastInlineScope(inl);
|
inl = LinkDotState::removeLastInlineScope(inl);
|
||||||
}
|
}
|
||||||
@ -1537,7 +1541,8 @@ class LinkDotScopeVisitor : public AstNVisitor {
|
|||||||
string scopename = refp ? refp->varp()->name() : xrefp->dotted() + "." + xrefp->name();
|
string scopename = refp ? refp->varp()->name() : xrefp->dotted() + "." + xrefp->name();
|
||||||
string baddot;
|
string baddot;
|
||||||
VSymEnt* okSymp;
|
VSymEnt* okSymp;
|
||||||
VSymEnt* symp = m_statep->findDotted(m_modSymp, scopename, baddot, okSymp);
|
VSymEnt* symp = m_statep->findDotted(nodep->lhsp()->fileline(), m_modSymp, scopename,
|
||||||
|
baddot, okSymp);
|
||||||
UASSERT_OBJ(symp, nodep, "No symbol for interface alias lhs");
|
UASSERT_OBJ(symp, nodep, "No symbol for interface alias lhs");
|
||||||
UINFO(5, " Found a linked scope LHS: " << scopename << " se" << cvtToHex(symp)
|
UINFO(5, " Found a linked scope LHS: " << scopename << " se" << cvtToHex(symp)
|
||||||
<< " " << symp->nodep() << endl);
|
<< " " << symp->nodep() << endl);
|
||||||
@ -2066,8 +2071,8 @@ private:
|
|||||||
string baddot;
|
string baddot;
|
||||||
VSymEnt* okSymp = NULL;
|
VSymEnt* okSymp = NULL;
|
||||||
if (allowScope) {
|
if (allowScope) {
|
||||||
foundp = m_statep->findDotted(m_ds.m_dotSymp, nodep->name(), baddot,
|
foundp = m_statep->findDotted(nodep->fileline(), m_ds.m_dotSymp, nodep->name(),
|
||||||
okSymp); // Maybe NULL
|
baddot, okSymp); // Maybe NULL
|
||||||
} else {
|
} else {
|
||||||
foundp = m_ds.m_dotSymp->findIdFallback(nodep->name());
|
foundp = m_ds.m_dotSymp->findIdFallback(nodep->name());
|
||||||
}
|
}
|
||||||
@ -2300,13 +2305,13 @@ private:
|
|||||||
// ignore (t_math_divw)
|
// ignore (t_math_divw)
|
||||||
dotSymp = m_modSymp;
|
dotSymp = m_modSymp;
|
||||||
string inl = AstNode::dedotName(nodep->inlinedDots());
|
string inl = AstNode::dedotName(nodep->inlinedDots());
|
||||||
dotSymp = m_statep->findDotted(dotSymp, inl, baddot, okSymp);
|
dotSymp = m_statep->findDotted(nodep->fileline(), dotSymp, inl, baddot, okSymp);
|
||||||
UASSERT_OBJ(dotSymp, nodep,
|
UASSERT_OBJ(dotSymp, nodep,
|
||||||
"Couldn't resolve inlined scope " << AstNode::prettyNameQ(baddot)
|
"Couldn't resolve inlined scope " << AstNode::prettyNameQ(baddot)
|
||||||
<< " in: " << nodep->inlinedDots());
|
<< " in: " << nodep->inlinedDots());
|
||||||
}
|
}
|
||||||
dotSymp
|
dotSymp = m_statep->findDotted(nodep->fileline(), dotSymp, nodep->dotted(), baddot,
|
||||||
= m_statep->findDotted(dotSymp, nodep->dotted(), baddot, okSymp); // Maybe NULL
|
okSymp); // Maybe NULL
|
||||||
if (!m_statep->forScopeCreation()) {
|
if (!m_statep->forScopeCreation()) {
|
||||||
VSymEnt* foundp = m_statep->findSymPrefixed(dotSymp, nodep->name(), baddot);
|
VSymEnt* foundp = m_statep->findSymPrefixed(dotSymp, nodep->name(), baddot);
|
||||||
AstVar* varp = foundp ? foundToVarp(foundp, nodep, nodep->lvalue()) : NULL;
|
AstVar* varp = foundp ? foundToVarp(foundp, nodep, nodep->lvalue()) : NULL;
|
||||||
@ -2454,7 +2459,8 @@ private:
|
|||||||
dotSymp = m_modSymp;
|
dotSymp = m_modSymp;
|
||||||
string inl = AstNode::dedotName(nodep->inlinedDots());
|
string inl = AstNode::dedotName(nodep->inlinedDots());
|
||||||
UINFO(8, " Inlined " << inl << endl);
|
UINFO(8, " Inlined " << inl << endl);
|
||||||
dotSymp = m_statep->findDotted(dotSymp, inl, baddot, okSymp);
|
dotSymp
|
||||||
|
= m_statep->findDotted(nodep->fileline(), dotSymp, inl, baddot, okSymp);
|
||||||
if (!dotSymp) {
|
if (!dotSymp) {
|
||||||
okSymp->cellErrorScopes(nodep);
|
okSymp->cellErrorScopes(nodep);
|
||||||
nodep->v3fatalSrc("Couldn't resolve inlined scope "
|
nodep->v3fatalSrc("Couldn't resolve inlined scope "
|
||||||
@ -2462,7 +2468,7 @@ private:
|
|||||||
<< " in: " << nodep->inlinedDots());
|
<< " in: " << nodep->inlinedDots());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dotSymp = m_statep->findDotted(dotSymp, nodep->dotted(), baddot,
|
dotSymp = m_statep->findDotted(nodep->fileline(), dotSymp, nodep->dotted(), baddot,
|
||||||
okSymp); // Maybe NULL
|
okSymp); // Maybe NULL
|
||||||
}
|
}
|
||||||
VSymEnt* foundp = m_statep->findSymPrefixed(dotSymp, nodep->name(), baddot);
|
VSymEnt* foundp = m_statep->findSymPrefixed(dotSymp, nodep->name(), baddot);
|
||||||
|
Loading…
Reference in New Issue
Block a user