mirror of
https://github.com/verilator/verilator.git
synced 2025-04-21 12:06:55 +00:00
Internals: Fix compares to null, part of bug1030. No functional change intended.
This commit is contained in:
parent
850100c9c2
commit
d56179df17
@ -122,8 +122,14 @@ private:
|
|||||||
return (nodep->user1p()->castGraphVertex());
|
return (nodep->user1p()->castGraphVertex());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AstNodeModule* findModuleSym(const string& modName) {
|
||||||
|
VSymEnt* foundp = m_mods.rootp()->findIdFallback(modName);
|
||||||
|
if (!foundp) return NULL;
|
||||||
|
else return foundp->nodep()->castNodeModule();
|
||||||
|
}
|
||||||
|
|
||||||
AstNodeModule* resolveModule(AstNode* nodep, const string& modName) {
|
AstNodeModule* resolveModule(AstNode* nodep, const string& modName) {
|
||||||
AstNodeModule* modp = m_mods.rootp()->findIdFallback(modName)->nodep()->castNodeModule();
|
AstNodeModule* modp = findModuleSym(modName);
|
||||||
if (!modp) {
|
if (!modp) {
|
||||||
// Read-subfile
|
// Read-subfile
|
||||||
// If file not found, make AstNotFoundModule, rather than error out.
|
// If file not found, make AstNotFoundModule, rather than error out.
|
||||||
@ -135,7 +141,7 @@ private:
|
|||||||
// We've read new modules, grab new pointers to their names
|
// We've read new modules, grab new pointers to their names
|
||||||
readModNames();
|
readModNames();
|
||||||
// Check again
|
// Check again
|
||||||
modp = m_mods.rootp()->findIdFallback(modName)->nodep()->castNodeModule();
|
modp = findModuleSym(modName);
|
||||||
if (!modp) {
|
if (!modp) {
|
||||||
// This shouldn't throw a message as parseFile will create a AstNotFoundModule for us
|
// This shouldn't throw a message as parseFile will create a AstNotFoundModule for us
|
||||||
nodep->v3error("Can't resolve module reference: "<<prettyName);
|
nodep->v3error("Can't resolve module reference: "<<prettyName);
|
||||||
@ -387,7 +393,7 @@ private:
|
|||||||
// Look at all modules, and store pointers to all module names
|
// Look at all modules, and store pointers to all module names
|
||||||
for (AstNodeModule* nextp,* nodep = v3Global.rootp()->modulesp(); nodep; nodep=nextp) {
|
for (AstNodeModule* nextp,* nodep = v3Global.rootp()->modulesp(); nodep; nodep=nextp) {
|
||||||
nextp = nodep->nextp()->castNodeModule();
|
nextp = nodep->nextp()->castNodeModule();
|
||||||
AstNode* foundp = m_mods.rootp()->findIdFallback(nodep->name())->nodep();
|
AstNodeModule* foundp = findModuleSym(nodep->name());
|
||||||
if (foundp && foundp != nodep) {
|
if (foundp && foundp != nodep) {
|
||||||
if (!(foundp->fileline()->warnIsOff(V3ErrorCode::MODDUP) || nodep->fileline()->warnIsOff(V3ErrorCode::MODDUP))) {
|
if (!(foundp->fileline()->warnIsOff(V3ErrorCode::MODDUP) || nodep->fileline()->warnIsOff(V3ErrorCode::MODDUP))) {
|
||||||
nodep->v3warn(MODDUP,"Duplicate declaration of module: "<<nodep->prettyName()<<endl
|
nodep->v3warn(MODDUP,"Duplicate declaration of module: "<<nodep->prettyName()<<endl
|
||||||
|
@ -207,7 +207,7 @@ public:
|
|||||||
// Note we only check for conflicts at the same level; it's ok if one block hides another
|
// Note we only check for conflicts at the same level; it's ok if one block hides another
|
||||||
// We also wouldn't want to not insert it even though it's lower down
|
// We also wouldn't want to not insert it even though it's lower down
|
||||||
VSymEnt* foundp = lookupSymp->findIdFlat(name);
|
VSymEnt* foundp = lookupSymp->findIdFlat(name);
|
||||||
AstNode* fnodep = foundp->nodep();
|
AstNode* fnodep = foundp ? foundp->nodep() : NULL;
|
||||||
if (!fnodep) {
|
if (!fnodep) {
|
||||||
// Not found, will add in a moment.
|
// Not found, will add in a moment.
|
||||||
} else if (nodep==fnodep) { // Already inserted.
|
} else if (nodep==fnodep) { // Already inserted.
|
||||||
@ -378,7 +378,7 @@ public:
|
|||||||
void computeIfaceVarSyms() {
|
void computeIfaceVarSyms() {
|
||||||
for (IfaceVarSyms::iterator it = m_ifaceVarSyms.begin(); it != m_ifaceVarSyms.end(); ++it) {
|
for (IfaceVarSyms::iterator it = m_ifaceVarSyms.begin(); it != m_ifaceVarSyms.end(); ++it) {
|
||||||
VSymEnt* varSymp = *it;
|
VSymEnt* varSymp = *it;
|
||||||
AstVar* varp = varSymp->nodep()->castVar();
|
AstVar* varp = varSymp ? varSymp->nodep()->castVar() : NULL;
|
||||||
UINFO(9, " insAllIface se"<<(void*)varSymp<<" "<<varp<<endl);
|
UINFO(9, " insAllIface se"<<(void*)varSymp<<" "<<varp<<endl);
|
||||||
AstIfaceRefDType* ifacerefp = ifaceRefFromArray(varp->subDTypep());
|
AstIfaceRefDType* ifacerefp = ifaceRefFromArray(varp->subDTypep());
|
||||||
if (!ifacerefp) varp->v3fatalSrc("Non-ifacerefs on list!");
|
if (!ifacerefp) varp->v3fatalSrc("Non-ifacerefs on list!");
|
||||||
@ -489,8 +489,8 @@ public:
|
|||||||
// then look up (inst name or modname)
|
// then look up (inst name or modname)
|
||||||
if (firstId) {
|
if (firstId) {
|
||||||
// Check this module - subcellnames
|
// Check this module - subcellnames
|
||||||
AstCell* cellp = lookupSymp->nodep()->castCell(); // Replicated below
|
AstCell* cellp = lookupSymp ? lookupSymp->nodep()->castCell() : NULL; // Replicated below
|
||||||
AstCellInline* inlinep = lookupSymp->nodep()->castCellInline(); // Replicated below
|
AstCellInline* inlinep = lookupSymp ? lookupSymp->nodep()->castCellInline() : NULL; // Replicated below
|
||||||
if (VSymEnt* findSymp = findWithAltFallback(lookupSymp, ident, altIdent)) {
|
if (VSymEnt* findSymp = findWithAltFallback(lookupSymp, ident, altIdent)) {
|
||||||
lookupSymp = findSymp;
|
lookupSymp = findSymp;
|
||||||
}
|
}
|
||||||
@ -501,8 +501,8 @@ public:
|
|||||||
else {
|
else {
|
||||||
while (lookupSymp) {
|
while (lookupSymp) {
|
||||||
lookupSymp = lookupSymp->parentp();
|
lookupSymp = lookupSymp->parentp();
|
||||||
cellp = lookupSymp->nodep()->castCell(); // Replicated above
|
cellp = lookupSymp ? lookupSymp->nodep()->castCell() : NULL; // Replicated above
|
||||||
inlinep = lookupSymp->nodep()->castCellInline(); // Replicated above
|
inlinep = lookupSymp ? lookupSymp->nodep()->castCellInline() : NULL; // Replicated above
|
||||||
if (lookupSymp) {
|
if (lookupSymp) {
|
||||||
UINFO(9,"\t\tUp to "<<lookupSymp<<endl);
|
UINFO(9,"\t\tUp to "<<lookupSymp<<endl);
|
||||||
if ((cellp && cellp->modp()->origName() == ident)
|
if ((cellp && cellp->modp()->origName() == ident)
|
||||||
@ -1033,7 +1033,7 @@ private:
|
|||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
nodep->v3warn(DEFPARAM,"Suggest replace defparam with Verilog 2001 #(."<<nodep->prettyName()<<"(...etc...))");
|
nodep->v3warn(DEFPARAM,"Suggest replace defparam with Verilog 2001 #(."<<nodep->prettyName()<<"(...etc...))");
|
||||||
VSymEnt* foundp = m_statep->getNodeSym(nodep)->findIdFallback(nodep->path());
|
VSymEnt* foundp = m_statep->getNodeSym(nodep)->findIdFallback(nodep->path());
|
||||||
AstCell* cellp = foundp->nodep()->castCell();
|
AstCell* cellp = foundp ? foundp->nodep()->castCell() : NULL;
|
||||||
if (!cellp) {
|
if (!cellp) {
|
||||||
nodep->v3error("In defparam, cell "<<nodep->path()<<" never declared");
|
nodep->v3error("In defparam, cell "<<nodep->path()<<" never declared");
|
||||||
} else {
|
} else {
|
||||||
@ -1055,7 +1055,7 @@ private:
|
|||||||
// Need to set pin numbers after varnames are created
|
// Need to set pin numbers after varnames are created
|
||||||
// But before we do the final resolution based on names
|
// But before we do the final resolution based on names
|
||||||
VSymEnt* foundp = m_statep->getNodeSym(m_modp)->findIdFlat(nodep->name());
|
VSymEnt* foundp = m_statep->getNodeSym(m_modp)->findIdFlat(nodep->name());
|
||||||
AstVar* refp = foundp->nodep()->castVar();
|
AstVar* refp = foundp ? foundp->nodep()->castVar() : NULL;
|
||||||
if (!refp) {
|
if (!refp) {
|
||||||
nodep->v3error("Input/output/inout declaration not found for port: "<<nodep->prettyName());
|
nodep->v3error("Input/output/inout declaration not found for port: "<<nodep->prettyName());
|
||||||
} else if (!refp->isIO() && !refp->isIfaceRef()) {
|
} else if (!refp->isIO() && !refp->isIfaceRef()) {
|
||||||
@ -1513,7 +1513,7 @@ private:
|
|||||||
if (!nodep->modVarp()) {
|
if (!nodep->modVarp()) {
|
||||||
if (!m_pinSymp) nodep->v3fatalSrc("Pin not under cell?\n");
|
if (!m_pinSymp) nodep->v3fatalSrc("Pin not under cell?\n");
|
||||||
VSymEnt* foundp = m_pinSymp->findIdFlat(nodep->name());
|
VSymEnt* foundp = m_pinSymp->findIdFlat(nodep->name());
|
||||||
AstVar* refp = foundp->nodep()->castVar();
|
AstVar* refp = foundp ? foundp->nodep()->castVar() : NULL;
|
||||||
const char* whatp = nodep->param() ? "parameter pin" : "pin";
|
const char* whatp = nodep->param() ? "parameter pin" : "pin";
|
||||||
if (!refp) {
|
if (!refp) {
|
||||||
if (nodep->name() == "__paramNumber1" && m_cellp->modp()->castPrimitive()) {
|
if (nodep->name() == "__paramNumber1" && m_cellp->modp()->castPrimitive()) {
|
||||||
@ -1661,8 +1661,10 @@ private:
|
|||||||
<<" n="<<foundp->nodep()<<endl);
|
<<" n="<<foundp->nodep()<<endl);
|
||||||
// What fell out?
|
// What fell out?
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
if (foundp->nodep()->castCell() || foundp->nodep()->castBegin()
|
if (!foundp) {
|
||||||
|| foundp->nodep()->castModule()) { // if top
|
} else if (foundp->nodep()->castCell()
|
||||||
|
|| foundp->nodep()->castBegin()
|
||||||
|
|| foundp->nodep()->castModule()) { // if top
|
||||||
if (allowScope) {
|
if (allowScope) {
|
||||||
ok = true;
|
ok = true;
|
||||||
if (m_ds.m_dotText!="") m_ds.m_dotText += ".";
|
if (m_ds.m_dotText!="") m_ds.m_dotText += ".";
|
||||||
@ -1679,7 +1681,8 @@ private:
|
|||||||
VSymEnt* cellEntp = m_statep->getNodeSym(cellp); if (!cellEntp) nodep->v3fatalSrc("No interface sym entry");
|
VSymEnt* cellEntp = m_statep->getNodeSym(cellp); if (!cellEntp) nodep->v3fatalSrc("No interface sym entry");
|
||||||
VSymEnt* parentEntp = cellEntp->parentp(); // Container of the var; probably a module or generate begin
|
VSymEnt* parentEntp = cellEntp->parentp(); // Container of the var; probably a module or generate begin
|
||||||
string findName = nodep->name()+"__Viftop";
|
string findName = nodep->name()+"__Viftop";
|
||||||
AstVar* ifaceRefVarp = parentEntp->findIdFallback(findName)->nodep()->castVar();
|
VSymEnt* ifaceSymp = parentEntp->findIdFallback(findName);
|
||||||
|
AstVar* ifaceRefVarp = ifaceSymp ? ifaceSymp->nodep()->castVar() : NULL;
|
||||||
if (!ifaceRefVarp) nodep->v3fatalSrc("Can't find interface var ref: "<<findName);
|
if (!ifaceRefVarp) nodep->v3fatalSrc("Can't find interface var ref: "<<findName);
|
||||||
//
|
//
|
||||||
ok = true;
|
ok = true;
|
||||||
@ -1811,7 +1814,7 @@ private:
|
|||||||
UINFO(9," linkVarRef se"<<(void*)m_curSymp<<" n="<<nodep<<endl);
|
UINFO(9," linkVarRef se"<<(void*)m_curSymp<<" n="<<nodep<<endl);
|
||||||
if (!m_curSymp) nodep->v3fatalSrc("NULL lookup symbol table");
|
if (!m_curSymp) nodep->v3fatalSrc("NULL lookup symbol table");
|
||||||
VSymEnt* foundp = m_curSymp->findIdFallback(nodep->name());
|
VSymEnt* foundp = m_curSymp->findIdFallback(nodep->name());
|
||||||
if (AstVar* varp = foundp->nodep()->castVar()) {
|
if (AstVar* varp = foundp ? foundp->nodep()->castVar() : NULL) {
|
||||||
nodep->varp(varp);
|
nodep->varp(varp);
|
||||||
nodep->packagep(foundp->packagep()); // Generally set by parse, but might be an import
|
nodep->packagep(foundp->packagep()); // Generally set by parse, but might be an import
|
||||||
}
|
}
|
||||||
@ -1845,7 +1848,7 @@ private:
|
|||||||
dotSymp = m_statep->findDotted(dotSymp, nodep->dotted(), baddot, okSymp); // Maybe NULL
|
dotSymp = m_statep->findDotted(dotSymp, nodep->dotted(), baddot, 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->nodep()->castVar(); // maybe NULL
|
AstVar* varp = foundp ? foundp->nodep()->castVar() : NULL;
|
||||||
nodep->varp(varp);
|
nodep->varp(varp);
|
||||||
UINFO(7," Resolved "<<nodep<<endl); // Also prints varp
|
UINFO(7," Resolved "<<nodep<<endl); // Also prints varp
|
||||||
if (!nodep->varp()) {
|
if (!nodep->varp()) {
|
||||||
@ -1864,7 +1867,7 @@ private:
|
|||||||
} else {
|
} else {
|
||||||
string baddot;
|
string baddot;
|
||||||
VSymEnt* foundp = m_statep->findSymPrefixed(dotSymp, nodep->name(), baddot);
|
VSymEnt* foundp = m_statep->findSymPrefixed(dotSymp, nodep->name(), baddot);
|
||||||
AstVarScope* vscp = foundp->nodep()->castVarScope(); // maybe NULL
|
AstVarScope* vscp = foundp ? foundp->nodep()->castVarScope() : NULL;
|
||||||
if (!vscp) {
|
if (!vscp) {
|
||||||
nodep->v3error("Can't find varpin scope of '"<<baddot<<"' in dotted signal: "<<nodep->dotted()+"."+nodep->prettyName());
|
nodep->v3error("Can't find varpin scope of '"<<baddot<<"' in dotted signal: "<<nodep->dotted()+"."+nodep->prettyName());
|
||||||
okSymp->cellErrorScopes(nodep);
|
okSymp->cellErrorScopes(nodep);
|
||||||
@ -2085,7 +2088,7 @@ private:
|
|||||||
} else {
|
} else {
|
||||||
foundp = m_curSymp->findIdFallback(nodep->name());
|
foundp = m_curSymp->findIdFallback(nodep->name());
|
||||||
}
|
}
|
||||||
if (AstTypedef* defp = foundp->nodep()->castTypedef()) {
|
if (AstTypedef* defp = foundp ? foundp->nodep()->castTypedef() : NULL) {
|
||||||
nodep->refDTypep(defp->subDTypep());
|
nodep->refDTypep(defp->subDTypep());
|
||||||
nodep->packagep(foundp->packagep());
|
nodep->packagep(foundp->packagep());
|
||||||
} else {
|
} else {
|
||||||
@ -2099,7 +2102,7 @@ private:
|
|||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
checkNoDot(nodep);
|
checkNoDot(nodep);
|
||||||
VSymEnt* foundp = m_curSymp->findIdFallback(nodep->name());
|
VSymEnt* foundp = m_curSymp->findIdFallback(nodep->name());
|
||||||
AstNodeFTask* taskp = foundp->nodep()->castNodeFTask();
|
AstNodeFTask* taskp = foundp ? foundp->nodep()->castNodeFTask() : NULL;
|
||||||
if (!taskp) { nodep->v3error("Can't find definition of exported task/function: "<<nodep->prettyName()); }
|
if (!taskp) { nodep->v3error("Can't find definition of exported task/function: "<<nodep->prettyName()); }
|
||||||
else if (taskp->dpiExport()) {
|
else if (taskp->dpiExport()) {
|
||||||
nodep->v3error("Function was already DPI Exported, duplicate not allowed: "<<nodep->prettyName());
|
nodep->v3error("Function was already DPI Exported, duplicate not allowed: "<<nodep->prettyName());
|
||||||
|
@ -118,7 +118,9 @@ public:
|
|||||||
}
|
}
|
||||||
AstNode* findEntUpward (const string& name) {
|
AstNode* findEntUpward (const string& name) {
|
||||||
// Lookup the given string as an identifier, return type of the id, scanning upward
|
// Lookup the given string as an identifier, return type of the id, scanning upward
|
||||||
return symCurrentp()->findIdFallback(name)->nodep();
|
VSymEnt* foundp = symCurrentp()->findIdFallback(name);
|
||||||
|
if (foundp) return foundp->nodep();
|
||||||
|
else return NULL;
|
||||||
}
|
}
|
||||||
void import(AstNode* packagep, const string& id_or_star) {
|
void import(AstNode* packagep, const string& id_or_star) {
|
||||||
// Import from package::id_or_star to this
|
// Import from package::id_or_star to this
|
||||||
|
@ -107,7 +107,7 @@ public:
|
|||||||
VSymEnt* parentp() const { return m_parentp; }
|
VSymEnt* parentp() const { return m_parentp; }
|
||||||
void packagep(AstPackage* entp) { m_packagep = entp; }
|
void packagep(AstPackage* entp) { m_packagep = entp; }
|
||||||
AstPackage* packagep() const { return m_packagep; }
|
AstPackage* packagep() const { return m_packagep; }
|
||||||
AstNode* nodep() const { if (!this) return NULL; else return m_nodep; } // null check so can call .findId(...)->nodep()
|
AstNode* nodep() const { return m_nodep; }
|
||||||
string symPrefix() const { return m_symPrefix; }
|
string symPrefix() const { return m_symPrefix; }
|
||||||
void symPrefix(const string& name) { m_symPrefix = name; }
|
void symPrefix(const string& name) { m_symPrefix = name; }
|
||||||
bool exported() const { return m_exported; }
|
bool exported() const { return m_exported; }
|
||||||
@ -284,7 +284,7 @@ inline VSymEnt::VSymEnt(VSymGraph* graphp, AstNode* nodep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline VSymEnt::VSymEnt(VSymGraph* graphp, const VSymEnt* symp)
|
inline VSymEnt::VSymEnt(VSymGraph* graphp, const VSymEnt* symp)
|
||||||
: m_nodep(symp->nodep()) {
|
: m_nodep(symp->m_nodep) {
|
||||||
m_fallbackp = symp->m_fallbackp;
|
m_fallbackp = symp->m_fallbackp;
|
||||||
m_parentp = symp->m_parentp;
|
m_parentp = symp->m_parentp;
|
||||||
m_packagep = symp->m_packagep;
|
m_packagep = symp->m_packagep;
|
||||||
|
@ -137,9 +137,7 @@ public:
|
|||||||
bool prelim() const { return m_stage & PRELIM; }
|
bool prelim() const { return m_stage & PRELIM; }
|
||||||
bool final() const { return m_stage & FINAL; }
|
bool final() const { return m_stage & FINAL; }
|
||||||
void dump(ostream& str) const {
|
void dump(ostream& str) const {
|
||||||
if (!this) {
|
if (!m_dtypep) {
|
||||||
str<<" VUP(NULL)";
|
|
||||||
} else if (!m_dtypep) {
|
|
||||||
str<<" VUP(s="<<m_stage<<",self)";
|
str<<" VUP(s="<<m_stage<<",self)";
|
||||||
} else {
|
} else {
|
||||||
str<<" VUP(s="<<m_stage<<",dt="<<(void*)dtypep()<<")";
|
str<<" VUP(s="<<m_stage<<",dt="<<(void*)dtypep()<<")";
|
||||||
@ -147,7 +145,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
ostream& operator<<(ostream& str, const WidthVP* vup) {
|
ostream& operator<<(ostream& str, const WidthVP* vup) {
|
||||||
vup->dump(str);
|
if (vup) vup->dump(str);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1030,19 +1030,20 @@ int V3ParseImp::lexToken() {
|
|||||||
// If an id, change the type based on symbol table
|
// If an id, change the type based on symbol table
|
||||||
// Note above sometimes converts yGLOBAL to a yaID__LEX
|
// Note above sometimes converts yGLOBAL to a yaID__LEX
|
||||||
if (token == yaID__LEX) {
|
if (token == yaID__LEX) {
|
||||||
AstNode* scp;
|
VSymEnt* foundp;
|
||||||
if (VSymEnt* look_underp = SYMP->nextId()) {
|
if (VSymEnt* look_underp = SYMP->nextId()) {
|
||||||
if (debugFlex()) { cout<<" lexToken: next id lookup forced under "<<look_underp<<endl; }
|
if (debugFlex()) { cout<<" lexToken: next id lookup forced under "<<look_underp<<endl; }
|
||||||
scp = look_underp->findIdFallback(*(yylval.strp))->nodep();
|
foundp = look_underp->findIdFallback(*(yylval.strp));
|
||||||
// "consume" it. Must set again if want another token under temp scope
|
// "consume" it. Must set again if want another token under temp scope
|
||||||
SYMP->nextId(NULL);
|
SYMP->nextId(NULL);
|
||||||
} else {
|
} else {
|
||||||
UINFO(7," lexToken: find upward "<<SYMP->symCurrentp()<<" for '"<<*(yylval.strp)<<"'"<<endl);
|
UINFO(7," lexToken: find upward "<<SYMP->symCurrentp()<<" for '"<<*(yylval.strp)<<"'"<<endl);
|
||||||
//if (debug()>=9) SYMP->symCurrentp()->dump(cout," -findtree: ",true);
|
//if (debug()>=9) SYMP->symCurrentp()->dump(cout," -findtree: ",true);
|
||||||
scp = SYMP->symCurrentp()->findIdFallback(*(yylval.strp))->nodep();
|
foundp = SYMP->symCurrentp()->findIdFallback(*(yylval.strp));
|
||||||
}
|
}
|
||||||
yylval.scp = scp;
|
if (foundp) {
|
||||||
if (scp) {
|
AstNode* scp = foundp->nodep();
|
||||||
|
yylval.scp = scp;
|
||||||
UINFO(7," lexToken: Found "<<scp<<endl);
|
UINFO(7," lexToken: Found "<<scp<<endl);
|
||||||
if (scp->castTypedef()) token = yaID__aTYPE;
|
if (scp->castTypedef()) token = yaID__aTYPE;
|
||||||
else if (scp->castTypedefFwd()) token = yaID__aTYPE;
|
else if (scp->castTypedefFwd()) token = yaID__aTYPE;
|
||||||
@ -1051,6 +1052,7 @@ int V3ParseImp::lexToken() {
|
|||||||
//UNSUP else if (scp->castCoverGroup()) token = yaID__aCOVERGROUP;
|
//UNSUP else if (scp->castCoverGroup()) token = yaID__aCOVERGROUP;
|
||||||
else token = yaID__ETC;
|
else token = yaID__ETC;
|
||||||
} else { // Not found
|
} else { // Not found
|
||||||
|
yylval.scp = NULL;
|
||||||
token = yaID__ETC;
|
token = yaID__ETC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,10 +121,13 @@ public:
|
|||||||
}
|
}
|
||||||
AstPackage* unitPackage(FileLine* fl) {
|
AstPackage* unitPackage(FileLine* fl) {
|
||||||
// Find one made earlier?
|
// Find one made earlier?
|
||||||
AstPackage* pkgp = SYMP->symRootp()->findIdFlat(AstPackage::dollarUnitName())->nodep()->castPackage();
|
VSymEnt* symp = SYMP->symRootp()->findIdFlat(AstPackage::dollarUnitName());
|
||||||
if (!pkgp) {
|
AstPackage* pkgp;
|
||||||
|
if (!symp) {
|
||||||
pkgp = PARSEP->rootp()->dollarUnitPkgAddp();
|
pkgp = PARSEP->rootp()->dollarUnitPkgAddp();
|
||||||
SYMP->reinsert(pkgp, SYMP->symRootp()); // Don't push/pop scope as they're global
|
SYMP->reinsert(pkgp, SYMP->symRootp()); // Don't push/pop scope as they're global
|
||||||
|
} else {
|
||||||
|
pkgp = symp->nodep()->castPackage();
|
||||||
}
|
}
|
||||||
return pkgp;
|
return pkgp;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user