aboutsummaryrefslogtreecommitdiffstats
path: root/libyul/optimiser/UnusedPruner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libyul/optimiser/UnusedPruner.cpp')
-rw-r--r--libyul/optimiser/UnusedPruner.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/libyul/optimiser/UnusedPruner.cpp b/libyul/optimiser/UnusedPruner.cpp
index 74b6bee4..37a74553 100644
--- a/libyul/optimiser/UnusedPruner.cpp
+++ b/libyul/optimiser/UnusedPruner.cpp
@@ -33,12 +33,14 @@ using namespace std;
using namespace dev;
using namespace dev::yul;
-UnusedPruner::UnusedPruner(Block& _ast)
+UnusedPruner::UnusedPruner(Block& _ast, set<string> const& _externallyUsedFunctions)
{
ReferencesCounter counter;
counter(_ast);
m_references = counter.references();
+ for (auto const& f: _externallyUsedFunctions)
+ ++m_references[f];
}
void UnusedPruner::operator()(Block& _block)
@@ -89,11 +91,11 @@ void UnusedPruner::operator()(Block& _block)
ASTModifier::operator()(_block);
}
-void UnusedPruner::runUntilStabilised(Block& _ast)
+void UnusedPruner::runUntilStabilised(Block& _ast, set<string> const& _externallyUsedFunctions)
{
while (true)
{
- UnusedPruner pruner(_ast);
+ UnusedPruner pruner(_ast, _externallyUsedFunctions);
pruner(_ast);
if (!pruner.shouldRunAgain())
return;