Internals: Add disabled duplicate function check (#4418)
This commit is contained in:
parent
5447ed2629
commit
16008acdf1
|
|
@ -162,6 +162,7 @@ class BrokenCheckVisitor final : public VNVisitorConst {
|
||||||
// STATE - for current visit position (use VL_RESTORER)
|
// STATE - for current visit position (use VL_RESTORER)
|
||||||
const AstCFunc* m_cfuncp = nullptr; // Current CFunc, if any
|
const AstCFunc* m_cfuncp = nullptr; // Current CFunc, if any
|
||||||
bool m_inScope = false; // Under AstScope
|
bool m_inScope = false; // Under AstScope
|
||||||
|
std::set<std::string> m_cFuncNames; // CFunc by name in current class/module
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// METHODS
|
// METHODS
|
||||||
|
|
@ -239,6 +240,18 @@ private:
|
||||||
void visit(AstScope* nodep) override {
|
void visit(AstScope* nodep) override {
|
||||||
VL_RESTORER(m_inScope);
|
VL_RESTORER(m_inScope);
|
||||||
m_inScope = true;
|
m_inScope = true;
|
||||||
|
VL_RESTORER(m_cFuncNames);
|
||||||
|
m_cFuncNames.clear();
|
||||||
|
processAndIterate(nodep);
|
||||||
|
}
|
||||||
|
void visit(AstNodeModule* nodep) override {
|
||||||
|
VL_RESTORER(m_cFuncNames);
|
||||||
|
m_cFuncNames.clear();
|
||||||
|
processAndIterate(nodep);
|
||||||
|
}
|
||||||
|
void visit(AstNodeUOrStructDType* nodep) override {
|
||||||
|
VL_RESTORER(m_cFuncNames);
|
||||||
|
m_cFuncNames.clear();
|
||||||
processAndIterate(nodep);
|
processAndIterate(nodep);
|
||||||
}
|
}
|
||||||
void visit(AstNodeVarRef* nodep) override {
|
void visit(AstNodeVarRef* nodep) override {
|
||||||
|
|
@ -268,6 +281,14 @@ private:
|
||||||
m_localsStack.clear();
|
m_localsStack.clear();
|
||||||
pushLocalScope();
|
pushLocalScope();
|
||||||
|
|
||||||
|
// Check for duplicate names, otherwise linker might just ignore them
|
||||||
|
string nameArgs = nodep->name();
|
||||||
|
if (!nodep->argTypes().empty()) nameArgs += "(" + nodep->argTypes() + ")";
|
||||||
|
if (false) { // bug4418
|
||||||
|
UASSERT_OBJ(m_cFuncNames.emplace(nameArgs).second, nodep,
|
||||||
|
"Duplicate cfunc name: '" << nameArgs << "'");
|
||||||
|
}
|
||||||
|
|
||||||
processAndIterate(nodep);
|
processAndIterate(nodep);
|
||||||
|
|
||||||
// Check suspect references are all to non-locals
|
// Check suspect references are all to non-locals
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue