Overload MSizeFinder::containsMSize() for Yul objects

This commit is contained in:
Kamil Śliwak 2023-05-15 14:19:40 +02:00
parent 8e35e8dd8e
commit dff774d82f
2 changed files with 18 additions and 3 deletions

View File

@ -94,6 +94,19 @@ bool MSizeFinder::containsMSize(Dialect const& _dialect, Block const& _ast)
return finder.m_msizeFound;
}
bool MSizeFinder::containsMSize(Dialect const& _dialect, Object const& _object)
{
if (containsMSize(_dialect, *_object.code))
return true;
for (shared_ptr<ObjectNode> const& node: _object.subObjects)
if (auto const* object = dynamic_cast<Object const*>(node.get()))
if (containsMSize(_dialect, *object))
return true;
return false;
}
void MSizeFinder::operator()(FunctionCall const& _functionCall)
{
ASTWalker::operator()(_functionCall);

View File

@ -21,10 +21,11 @@
#pragma once
#include <libyul/optimiser/ASTWalker.h>
#include <libyul/SideEffects.h>
#include <libyul/optimiser/CallGraphGenerator.h>
#include <libyul/AST.h>
#include <libyul/Object.h>
#include <libyul/SideEffects.h>
#include <libyul/optimiser/ASTWalker.h>
#include <libyul/optimiser/CallGraphGenerator.h>
#include <set>
@ -143,6 +144,7 @@ class MSizeFinder: public ASTWalker
{
public:
static bool containsMSize(Dialect const& _dialect, Block const& _ast);
static bool containsMSize(Dialect const& _dialect, Object const& _object);
using ASTWalker::operator();
void operator()(FunctionCall const& _funCall) override;