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:
Yutetsu TAKATSUKASA 2020-07-04 22:35:04 +09:00 committed by GitHub
parent 30600bf1a3
commit 8291ef6537
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -539,8 +539,8 @@ private:
}
public:
VSymEnt* findDotted(VSymEnt* lookupSymp, const string& dotname, string& baddot,
VSymEnt*& okSymp) {
VSymEnt* findDotted(FileLine* /*refLocationp*/, VSymEnt* lookupSymp, const string& dotname,
string& baddot, VSymEnt*& okSymp) {
// Given a dotted hierarchy name, return where in scope it is
// Note when dotname=="" we just fall through and return lookupSymp
UINFO(8, " dottedFind se" << cvtToHex(lookupSymp) << " '" << dotname << "'" << endl);
@ -875,7 +875,7 @@ class LinkDotFindVisitor : public AstNVisitor {
string scope = origname.substr(0, pos);
string baddot;
VSymEnt* okSymp;
aboveSymp = m_statep->findDotted(aboveSymp, scope, baddot, okSymp);
aboveSymp = m_statep->findDotted(nodep->fileline(), aboveSymp, scope, baddot, okSymp);
UASSERT_OBJ(aboveSymp, nodep,
"Can't find cell insertion point at " << AstNode::prettyNameQ(baddot)
<< " in: " << nodep->prettyNameQ());
@ -906,7 +906,7 @@ class LinkDotFindVisitor : public AstNVisitor {
string ident = dottedname.substr(pos + strlen("__DOT__"));
string baddot;
VSymEnt* okSymp;
aboveSymp = m_statep->findDotted(aboveSymp, dotted, baddot, okSymp);
aboveSymp = m_statep->findDotted(nodep->fileline(), aboveSymp, dotted, baddot, okSymp);
UASSERT_OBJ(aboveSymp, nodep,
"Can't find cellinline insertion point at "
<< AstNode::prettyNameQ(baddot) << " in: " << nodep->prettyNameQ());
@ -1106,7 +1106,8 @@ class LinkDotFindVisitor : public AstNVisitor {
= new AstVar(nodep->fileline(), AstVarType(AstVarType::GPARAM),
nodep->name(), nodep);
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);
UINFO(9, " replace parameter " << nodep << endl);
UINFO(9, " with " << newp << endl);
@ -1459,13 +1460,15 @@ class LinkDotScopeVisitor : public AstNVisitor {
string ifcellname = dtypep->cellName();
string baddot;
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,
"No symbol for interface cell: " << nodep->prettyNameQ(ifcellname));
UINFO(5, " Found interface cell: se" << cvtToHex(cellSymp) << " "
<< cellSymp->nodep() << endl);
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,
"No symbol for interface modport: "
<< nodep->prettyNameQ(dtypep->modportName()));
@ -1514,7 +1517,8 @@ class LinkDotScopeVisitor : public AstNVisitor {
= refp ? refp->name() : (inl.size() ? (inl + xrefp->name()) : xrefp->name());
string baddot;
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;
inl = LinkDotState::removeLastInlineScope(inl);
}
@ -1537,7 +1541,8 @@ class LinkDotScopeVisitor : public AstNVisitor {
string scopename = refp ? refp->varp()->name() : xrefp->dotted() + "." + xrefp->name();
string baddot;
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");
UINFO(5, " Found a linked scope LHS: " << scopename << " se" << cvtToHex(symp)
<< " " << symp->nodep() << endl);
@ -2066,8 +2071,8 @@ private:
string baddot;
VSymEnt* okSymp = NULL;
if (allowScope) {
foundp = m_statep->findDotted(m_ds.m_dotSymp, nodep->name(), baddot,
okSymp); // Maybe NULL
foundp = m_statep->findDotted(nodep->fileline(), m_ds.m_dotSymp, nodep->name(),
baddot, okSymp); // Maybe NULL
} else {
foundp = m_ds.m_dotSymp->findIdFallback(nodep->name());
}
@ -2300,13 +2305,13 @@ private:
// ignore (t_math_divw)
dotSymp = m_modSymp;
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,
"Couldn't resolve inlined scope " << AstNode::prettyNameQ(baddot)
<< " in: " << nodep->inlinedDots());
}
dotSymp
= m_statep->findDotted(dotSymp, nodep->dotted(), baddot, okSymp); // Maybe NULL
dotSymp = m_statep->findDotted(nodep->fileline(), dotSymp, nodep->dotted(), baddot,
okSymp); // Maybe NULL
if (!m_statep->forScopeCreation()) {
VSymEnt* foundp = m_statep->findSymPrefixed(dotSymp, nodep->name(), baddot);
AstVar* varp = foundp ? foundToVarp(foundp, nodep, nodep->lvalue()) : NULL;
@ -2454,7 +2459,8 @@ private:
dotSymp = m_modSymp;
string inl = AstNode::dedotName(nodep->inlinedDots());
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) {
okSymp->cellErrorScopes(nodep);
nodep->v3fatalSrc("Couldn't resolve inlined scope "
@ -2462,7 +2468,7 @@ private:
<< " in: " << nodep->inlinedDots());
}
}
dotSymp = m_statep->findDotted(dotSymp, nodep->dotted(), baddot,
dotSymp = m_statep->findDotted(nodep->fileline(), dotSymp, nodep->dotted(), baddot,
okSymp); // Maybe NULL
}
VSymEnt* foundp = m_statep->findSymPrefixed(dotSymp, nodep->name(), baddot);