Add error message when modules have duplicate names.

git-svn-id: file://localhost/svn/verilator/trunk/verilator@1025 77ca24e4-aefa-0310-84f0-b9a241c72d87
This commit is contained in:
Wilson Snyder
2008-04-09 13:56:40 +00:00
parent 3a2f8224e4
commit ecdbd72fa1
4 changed files with 48 additions and 1 deletions
+5 -1
View File
@@ -210,7 +210,11 @@ private:
void readModNames() {
// Look at all modules, and store pointers to all module names
for (AstModule* nodep = v3Global.rootp()->modulesp(); nodep; nodep=nodep->nextp()->castModule()) {
if (!m_mods.findIdName(nodep->name())) {
AstNode* foundp = m_mods.findIdName(nodep->name());
if (foundp && foundp != nodep) {
nodep->v3error("Duplicate declaration of module: "<<nodep->prettyName());
foundp->v3error("... Location of original declaration");
} else if (!foundp) {
m_mods.insert(nodep->name(), nodep);
}
}