aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libsolidity/interface/CompilerStack.cpp3
-rw-r--r--libyul/YulString.h12
-rw-r--r--test/libyul/YulOptimizerTest.cpp2
3 files changed, 15 insertions, 2 deletions
diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp
index 1f58245f..e0909eb3 100644
--- a/libsolidity/interface/CompilerStack.cpp
+++ b/libsolidity/interface/CompilerStack.cpp
@@ -47,6 +47,8 @@
#include <libevmasm/Exceptions.h>
+#include <libyul/YulString.h>
+
#include <libdevcore/SwarmHash.h>
#include <libdevcore/JSON.h>
@@ -104,6 +106,7 @@ void CompilerStack::reset(bool _keepSources)
m_stackState = Empty;
m_sources.clear();
}
+ yul::YulStringRepository::instance().reset();
m_libraries.clear();
m_evmVersion = EVMVersion();
m_optimize = false;
diff --git a/libyul/YulString.h b/libyul/YulString.h
index ae01c83f..a8015239 100644
--- a/libyul/YulString.h
+++ b/libyul/YulString.h
@@ -35,9 +35,9 @@ namespace yul
class YulStringRepository: boost::noncopyable
{
public:
- YulStringRepository(): m_strings{std::make_shared<std::string>()}
+ YulStringRepository()
{
- m_ids[std::string{}] = 0;
+ reset();
}
static YulStringRepository& instance()
{
@@ -61,6 +61,14 @@ public:
return *m_strings.at(_id);
}
+ void reset()
+ {
+ m_strings.clear();
+ m_ids.clear();
+ m_strings.emplace_back(std::make_shared<std::string>());
+ m_ids[std::string{}] = 0;
+ }
+
private:
std::vector<std::shared_ptr<std::string>> m_strings;
std::map<std::string, size_t> m_ids;
diff --git a/test/libyul/YulOptimizerTest.cpp b/test/libyul/YulOptimizerTest.cpp
index d455c892..38390035 100644
--- a/test/libyul/YulOptimizerTest.cpp
+++ b/test/libyul/YulOptimizerTest.cpp
@@ -90,6 +90,8 @@ YulOptimizerTest::YulOptimizerTest(string const& _filename)
bool YulOptimizerTest::run(ostream& _stream, string const& _linePrefix, bool const _formatted)
{
+ yul::YulStringRepository::instance().reset();
+
assembly::AsmPrinter printer{m_yul};
shared_ptr<Block> ast;
shared_ptr<assembly::AsmAnalysisInfo> analysisInfo;