mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #12766 from ethereum/removeUnneededHeader
Remove unneeded header files.
This commit is contained in:
commit
02637d56e5
@ -55,6 +55,30 @@ OptionalStatements replaceConstArgSwitch(Switch& _switchStmt, u256 const& _const
|
||||
return optional<vector<Statement>>{vector<Statement>{}};
|
||||
}
|
||||
|
||||
optional<u256> hasLiteralValue(Expression const& _expression)
|
||||
{
|
||||
if (holds_alternative<Literal>(_expression))
|
||||
return valueOfLiteral(std::get<Literal>(_expression));
|
||||
else
|
||||
return std::optional<u256>();
|
||||
}
|
||||
|
||||
bool expressionAlwaysTrue(Expression const& _expression)
|
||||
{
|
||||
if (std::optional<u256> value = hasLiteralValue(_expression))
|
||||
return *value != 0;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
bool expressionAlwaysFalse(Expression const& _expression)
|
||||
{
|
||||
if (std::optional<u256> value = hasLiteralValue(_expression))
|
||||
return *value == 0;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void StructuralSimplifier::run(OptimiserStepContext&, Block& _ast)
|
||||
@ -103,27 +127,3 @@ void StructuralSimplifier::simplify(std::vector<yul::Statement>& _statements)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
bool StructuralSimplifier::expressionAlwaysTrue(Expression const& _expression)
|
||||
{
|
||||
if (std::optional<u256> value = hasLiteralValue(_expression))
|
||||
return *value != 0;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
bool StructuralSimplifier::expressionAlwaysFalse(Expression const& _expression)
|
||||
{
|
||||
if (std::optional<u256> value = hasLiteralValue(_expression))
|
||||
return *value == 0;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<u256> StructuralSimplifier::hasLiteralValue(Expression const& _expression) const
|
||||
{
|
||||
if (holds_alternative<Literal>(_expression))
|
||||
return valueOfLiteral(std::get<Literal>(_expression));
|
||||
else
|
||||
return std::optional<u256>();
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <libyul/optimiser/ASTWalker.h>
|
||||
#include <libyul/optimiser/DataFlowAnalyzer.h>
|
||||
#include <libyul/optimiser/OptimiserStep.h>
|
||||
#include <libsolutil/Common.h>
|
||||
|
||||
@ -50,9 +49,6 @@ private:
|
||||
StructuralSimplifier() = default;
|
||||
|
||||
void simplify(std::vector<Statement>& _statements);
|
||||
bool expressionAlwaysTrue(Expression const& _expression);
|
||||
bool expressionAlwaysFalse(Expression const& _expression);
|
||||
std::optional<u256> hasLiteralValue(Expression const& _expression) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include <libyul/Object.h>
|
||||
#include <libyul/optimiser/KnowledgeBase.h>
|
||||
#include <libyul/optimiser/SSAValueTracker.h>
|
||||
#include <libyul/optimiser/DataFlowAnalyzer.h>
|
||||
#include <libyul/optimiser/NameDispenser.h>
|
||||
#include <libyul/optimiser/CommonSubexpressionEliminator.h>
|
||||
#include <libyul/backends/evm/EVMDialect.h>
|
||||
|
Loading…
Reference in New Issue
Block a user