aboutsummaryrefslogtreecommitdiffstats
path: root/libyul/optimiser/NameDispenser.h
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-10-29 22:12:02 +0800
committerchriseth <chris@ethereum.org>2018-11-08 02:30:27 +0800
commit674e17c2a895eff6729357d8c10db709ac368b79 (patch)
tree300a55700b068709f36340563db1b43e5b8b1188 /libyul/optimiser/NameDispenser.h
parent0a96f091ab63e8d77106e00590a442c59714eecb (diff)
downloaddexon-solidity-674e17c2a895eff6729357d8c10db709ac368b79.tar
dexon-solidity-674e17c2a895eff6729357d8c10db709ac368b79.tar.gz
dexon-solidity-674e17c2a895eff6729357d8c10db709ac368b79.tar.bz2
dexon-solidity-674e17c2a895eff6729357d8c10db709ac368b79.tar.lz
dexon-solidity-674e17c2a895eff6729357d8c10db709ac368b79.tar.xz
dexon-solidity-674e17c2a895eff6729357d8c10db709ac368b79.tar.zst
dexon-solidity-674e17c2a895eff6729357d8c10db709ac368b79.zip
Performance: Replace string by special single-copy YulString class.
Diffstat (limited to 'libyul/optimiser/NameDispenser.h')
-rw-r--r--libyul/optimiser/NameDispenser.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/libyul/optimiser/NameDispenser.h b/libyul/optimiser/NameDispenser.h
index 5fbf5f8e..57adbcad 100644
--- a/libyul/optimiser/NameDispenser.h
+++ b/libyul/optimiser/NameDispenser.h
@@ -21,8 +21,9 @@
#include <libyul/ASTDataForward.h>
+#include <libyul/YulString.h>
+
#include <set>
-#include <string>
namespace dev
{
@@ -41,18 +42,18 @@ public:
/// Initialize the name dispenser with all the names used in the given AST.
explicit NameDispenser(Block const& _ast);
/// Initialize the name dispenser with the given used names.
- explicit NameDispenser(std::set<std::string> _usedNames);
+ explicit NameDispenser(std::set<YulString> _usedNames);
/// @returns a currently unused name that should be similar to _nameHint
/// and prefixed by _context if present.
/// If the resulting name would be too long, trims the context at the end
/// and the name hint at the start.
- std::string newName(std::string const& _nameHint, std::string const& _context = {});
+ YulString newName(YulString _nameHint, YulString _context = {});
private:
- std::string newNameInternal(std::string const& _nameHint);
+ YulString newNameInternal(YulString _nameHint);
- std::set<std::string> m_usedNames;
+ std::set<YulString> m_usedNames;
};
}