mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
ObjectCompilerTest: Replace 'optimize' setting with 'optimizationPreset'
This commit is contained in:
parent
9c6f8c011f
commit
a51d72fb89
@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
#include <test/libyul/ObjectCompilerTest.h>
|
#include <test/libyul/ObjectCompilerTest.h>
|
||||||
|
|
||||||
|
#include <test/libsolidity/util/SoltestErrors.h>
|
||||||
|
|
||||||
#include <libsolutil/AnsiColorized.h>
|
#include <libsolutil/AnsiColorized.h>
|
||||||
|
|
||||||
#include <libyul/AssemblyStack.h>
|
#include <libyul/AssemblyStack.h>
|
||||||
@ -43,7 +45,16 @@ ObjectCompilerTest::ObjectCompilerTest(string const& _filename):
|
|||||||
TestCase(_filename)
|
TestCase(_filename)
|
||||||
{
|
{
|
||||||
m_source = m_reader.source();
|
m_source = m_reader.source();
|
||||||
m_optimize = m_reader.boolSetting("optimize", false);
|
m_optimisationPreset = m_reader.enumSetting<OptimisationPreset>(
|
||||||
|
"optimizationPreset",
|
||||||
|
{
|
||||||
|
{"none", OptimisationPreset::None},
|
||||||
|
{"minimal", OptimisationPreset::Minimal},
|
||||||
|
{"standard", OptimisationPreset::Standard},
|
||||||
|
{"full", OptimisationPreset::Full},
|
||||||
|
},
|
||||||
|
"minimal"
|
||||||
|
);
|
||||||
m_wasm = m_reader.boolSetting("wasm", false);
|
m_wasm = m_reader.boolSetting("wasm", false);
|
||||||
m_expectation = m_reader.simpleExpectations();
|
m_expectation = m_reader.simpleExpectations();
|
||||||
}
|
}
|
||||||
@ -53,7 +64,7 @@ TestCase::TestResult ObjectCompilerTest::run(ostream& _stream, string const& _li
|
|||||||
AssemblyStack stack(
|
AssemblyStack stack(
|
||||||
EVMVersion(),
|
EVMVersion(),
|
||||||
m_wasm ? AssemblyStack::Language::Ewasm : AssemblyStack::Language::StrictAssembly,
|
m_wasm ? AssemblyStack::Language::Ewasm : AssemblyStack::Language::StrictAssembly,
|
||||||
m_optimize ? OptimiserSettings::full() : OptimiserSettings::minimal()
|
OptimiserSettings::preset(m_optimisationPreset)
|
||||||
);
|
);
|
||||||
if (!stack.parseAndAnalyze("source", m_source))
|
if (!stack.parseAndAnalyze("source", m_source))
|
||||||
{
|
{
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
#include <test/TestCase.h>
|
#include <test/TestCase.h>
|
||||||
|
|
||||||
|
#include <libsolidity/interface/OptimiserSettings.h>
|
||||||
|
|
||||||
namespace solidity::langutil
|
namespace solidity::langutil
|
||||||
{
|
{
|
||||||
class Scanner;
|
class Scanner;
|
||||||
@ -54,7 +56,7 @@ private:
|
|||||||
|
|
||||||
static void printErrors(std::ostream& _stream, langutil::ErrorList const& _errors);
|
static void printErrors(std::ostream& _stream, langutil::ErrorList const& _errors);
|
||||||
|
|
||||||
bool m_optimize = false;
|
frontend::OptimisationPreset m_optimisationPreset;
|
||||||
bool m_wasm = false;
|
bool m_wasm = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ object "t" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// optimize: true
|
// optimizationPreset: full
|
||||||
// ----
|
// ----
|
||||||
// Assembly:
|
// Assembly:
|
||||||
// /* "source":23:147 */
|
// /* "source":23:147 */
|
||||||
|
@ -15,7 +15,7 @@ object "a" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// optimize: true
|
// optimizationPreset: full
|
||||||
// ----
|
// ----
|
||||||
// Assembly:
|
// Assembly:
|
||||||
// /* "source":48:49 */
|
// /* "source":48:49 */
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
sstore(add(x, 0), z)
|
sstore(add(x, 0), z)
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// optimize: true
|
// optimizationPreset: full
|
||||||
// ----
|
// ----
|
||||||
// Assembly:
|
// Assembly:
|
||||||
// /* "source":26:27 */
|
// /* "source":26:27 */
|
||||||
|
Loading…
Reference in New Issue
Block a user