aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen/ABIFunctions.h
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-10-17 23:05:49 +0800
committerGitHub <noreply@github.com>2018-10-17 23:05:49 +0800
commitf2f72ff7eea9a461ae8c71a13428e499c8b91025 (patch)
tree02c46d9f13ff85b5a2ad3d124054bdfc71af4791 /libsolidity/codegen/ABIFunctions.h
parent6b7d182658988f22ba23cc3852510864881515e2 (diff)
parent16c2a775fd532c301eae3abecc8d68c5c421a9a0 (diff)
downloaddexon-solidity-f2f72ff7eea9a461ae8c71a13428e499c8b91025.tar
dexon-solidity-f2f72ff7eea9a461ae8c71a13428e499c8b91025.tar.gz
dexon-solidity-f2f72ff7eea9a461ae8c71a13428e499c8b91025.tar.bz2
dexon-solidity-f2f72ff7eea9a461ae8c71a13428e499c8b91025.tar.lz
dexon-solidity-f2f72ff7eea9a461ae8c71a13428e499c8b91025.tar.xz
dexon-solidity-f2f72ff7eea9a461ae8c71a13428e499c8b91025.tar.zst
dexon-solidity-f2f72ff7eea9a461ae8c71a13428e499c8b91025.zip
Merge pull request #5227 from ethereum/doNotRemoveExternallyUsedFunction
Prevent externally used functions from being removed.
Diffstat (limited to 'libsolidity/codegen/ABIFunctions.h')
-rw-r--r--libsolidity/codegen/ABIFunctions.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/libsolidity/codegen/ABIFunctions.h b/libsolidity/codegen/ABIFunctions.h
index 3caaa1d9..e9ffe4fb 100644
--- a/libsolidity/codegen/ABIFunctions.h
+++ b/libsolidity/codegen/ABIFunctions.h
@@ -28,6 +28,7 @@
#include <vector>
#include <functional>
+#include <set>
#include <map>
namespace dev {
@@ -80,8 +81,11 @@ public:
/// stack slot, it takes exactly that number of values.
std::string tupleDecoder(TypePointers const& _types, bool _fromMemory = false);
- /// @returns concatenation of all generated functions.
- std::string requestedFunctions();
+ /// @returns concatenation of all generated functions and a set of the
+ /// externally used functions.
+ /// Clears the internal list, i.e. calling it again will result in an
+ /// empty return value.
+ std::pair<std::string, std::set<std::string>> requestedFunctions();
private:
/// @returns the name of the cleanup function for the given type and
@@ -224,12 +228,17 @@ private:
/// cases.
std::string createFunction(std::string const& _name, std::function<std::string()> const& _creator);
+ /// Helper function that uses @a _creator to create a function and add it to
+ /// @a m_requestedFunctions if it has not been created yet and returns @a _name in both
+ /// cases. Also adds it to the list of externally used functions.
+ std::string createExternallyUsedFunction(std::string const& _name, std::function<std::string()> const& _creator);
+
/// @returns the size of the static part of the encoding of the given types.
static size_t headSize(TypePointers const& _targetTypes);
/// Map from function name to code for a multi-use function.
std::map<std::string, std::string> m_requestedFunctions;
-
+ std::set<std::string> m_externallyUsedFunctions;
EVMVersion m_evmVersion;
};