aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis/StaticAnalyzer.h
diff options
context:
space:
mode:
authorRhett Aultman <roadriverrail@gmail.com>2017-04-14 22:48:59 +0800
committerchriseth <chris@ethereum.org>2017-05-03 17:26:21 +0800
commita40c8cfb68f75c22c0082714d99e9c3a24a31051 (patch)
tree4bf4be5f3a42924fbd91cda02906ad3ef201be3e /libsolidity/analysis/StaticAnalyzer.h
parentc09f071ff693f52a2a1434cfd6963b2d1818776e (diff)
downloaddexon-solidity-a40c8cfb68f75c22c0082714d99e9c3a24a31051.tar.gz
dexon-solidity-a40c8cfb68f75c22c0082714d99e9c3a24a31051.tar.zst
dexon-solidity-a40c8cfb68f75c22c0082714d99e9c3a24a31051.zip
Warn on unused local variables
Analyze functions for all local variables, parameters, and named return variables which are never used in the function, and issue a warning.
Diffstat (limited to 'libsolidity/analysis/StaticAnalyzer.h')
-rw-r--r--libsolidity/analysis/StaticAnalyzer.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/libsolidity/analysis/StaticAnalyzer.h b/libsolidity/analysis/StaticAnalyzer.h
index 84342322..134ff95a 100644
--- a/libsolidity/analysis/StaticAnalyzer.h
+++ b/libsolidity/analysis/StaticAnalyzer.h
@@ -61,6 +61,8 @@ private:
virtual void endVisit(FunctionDefinition const& _function) override;
virtual bool visit(ExpressionStatement const& _statement) override;
+ virtual bool visit(VariableDeclaration const& _variable) override;
+ virtual bool visit(Identifier const& _identifier) override;
virtual bool visit(MemberAccess const& _memberAccess) override;
@@ -71,6 +73,10 @@ private:
/// Flag that indicates whether a public function does not contain the "payable" modifier.
bool m_nonPayablePublic = false;
+
+ std::map<VariableDeclaration const*, int> m_localVarUseCount;
+
+ bool m_inFunction = false;
};
}