mirror of
https://github.com/verilator/verilator.git
synced 2026-10-02 16:13:34 +02:00
Internals: Add disabled duplicate function check (#4418)
This commit is contained in:
@@ -162,6 +162,7 @@ class BrokenCheckVisitor final : public VNVisitorConst {
|
||||
// STATE - for current visit position (use VL_RESTORER)
|
||||
const AstCFunc* m_cfuncp = nullptr; // Current CFunc, if any
|
||||
bool m_inScope = false; // Under AstScope
|
||||
std::set<std::string> m_cFuncNames; // CFunc by name in current class/module
|
||||
|
||||
private:
|
||||
// METHODS
|
||||
@@ -239,6 +240,18 @@ private:
|
||||
void visit(AstScope* nodep) override {
|
||||
VL_RESTORER(m_inScope);
|
||||
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);
|
||||
}
|
||||
void visit(AstNodeVarRef* nodep) override {
|
||||
@@ -268,6 +281,14 @@ private:
|
||||
m_localsStack.clear();
|
||||
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);
|
||||
|
||||
// Check suspect references are all to non-locals
|
||||
|
||||
Reference in New Issue
Block a user