diff options
author | Daniel Kirchner <daniel@ekpyron.org> | 2018-04-07 00:10:26 +0800 |
---|---|---|
committer | Daniel Kirchner <daniel@ekpyron.org> | 2018-04-07 00:10:26 +0800 |
commit | b2753aa05307d8142a319212c5fdd9a3c7f383fe (patch) | |
tree | 961fd42a1be449d95e6e41c7781c2e2026771609 /libsolidity/analysis/StaticAnalyzer.cpp | |
parent | 9bd49516d8f10e49b28a51fb68a9dfe195a9bbe4 (diff) | |
download | dexon-solidity-b2753aa05307d8142a319212c5fdd9a3c7f383fe.tar dexon-solidity-b2753aa05307d8142a319212c5fdd9a3c7f383fe.tar.gz dexon-solidity-b2753aa05307d8142a319212c5fdd9a3c7f383fe.tar.bz2 dexon-solidity-b2753aa05307d8142a319212c5fdd9a3c7f383fe.tar.lz dexon-solidity-b2753aa05307d8142a319212c5fdd9a3c7f383fe.tar.xz dexon-solidity-b2753aa05307d8142a319212c5fdd9a3c7f383fe.tar.zst dexon-solidity-b2753aa05307d8142a319212c5fdd9a3c7f383fe.zip |
Static Analyzer: Fix non-deterministic order of unused variable warnings.
Diffstat (limited to 'libsolidity/analysis/StaticAnalyzer.cpp')
-rw-r--r-- | libsolidity/analysis/StaticAnalyzer.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libsolidity/analysis/StaticAnalyzer.cpp b/libsolidity/analysis/StaticAnalyzer.cpp index d96f8748..33b0e296 100644 --- a/libsolidity/analysis/StaticAnalyzer.cpp +++ b/libsolidity/analysis/StaticAnalyzer.cpp @@ -78,13 +78,13 @@ void StaticAnalyzer::endVisit(FunctionDefinition const&) for (auto const& var: m_localVarUseCount) if (var.second == 0) { - if (var.first->isCallableParameter()) + if (var.first.second->isCallableParameter()) m_errorReporter.warning( - var.first->location(), + var.first.second->location(), "Unused function parameter. Remove or comment out the variable name to silence this warning." ); else - m_errorReporter.warning(var.first->location(), "Unused local variable."); + m_errorReporter.warning(var.first.second->location(), "Unused local variable."); } m_localVarUseCount.clear(); @@ -97,7 +97,7 @@ bool StaticAnalyzer::visit(Identifier const& _identifier) { solAssert(!var->name().empty(), ""); if (var->isLocalVariable()) - m_localVarUseCount[var] += 1; + m_localVarUseCount[make_pair(var->id(), var)] += 1; } return true; } @@ -109,7 +109,7 @@ bool StaticAnalyzer::visit(VariableDeclaration const& _variable) solAssert(_variable.isLocalVariable(), ""); if (_variable.name() != "") // This is not a no-op, the entry might pre-exist. - m_localVarUseCount[&_variable] += 0; + m_localVarUseCount[make_pair(_variable.id(), &_variable)] += 0; } else if (_variable.isStateVariable()) { @@ -132,7 +132,7 @@ bool StaticAnalyzer::visit(Return const& _return) if (m_currentFunction && _return.expression()) for (auto const& var: m_currentFunction->returnParameters()) if (!var->name().empty()) - m_localVarUseCount[var.get()] += 1; + m_localVarUseCount[make_pair(var->id(), var.get())] += 1; return true; } @@ -224,7 +224,7 @@ bool StaticAnalyzer::visit(InlineAssembly const& _inlineAssembly) { solAssert(!var->name().empty(), ""); if (var->isLocalVariable()) - m_localVarUseCount[var] += 1; + m_localVarUseCount[make_pair(var->id(), var)] += 1; } } |