Pass DebugInfoSelection down to the code handling assembly printing

This commit is contained in:
Kamil Śliwak 2021-09-17 20:15:19 +02:00
parent f7c4ed849d
commit bcfefc79d9
28 changed files with 170 additions and 47 deletions

View File

@ -75,6 +75,7 @@ public:
RevertStrings _revertStrings,
OptimiserSettings _optimiserSettings,
std::map<std::string, unsigned> _sourceIndices,
langutil::DebugInfoSelection const& _debugInfoSelection,
langutil::CharStreamProvider const* _soliditySourceProvider
):
m_evmVersion(_evmVersion),
@ -82,6 +83,7 @@ public:
m_revertStrings(_revertStrings),
m_optimiserSettings(std::move(_optimiserSettings)),
m_sourceIndices(std::move(_sourceIndices)),
m_debugInfoSelection(_debugInfoSelection),
m_soliditySourceProvider(_soliditySourceProvider)
{}
@ -222,7 +224,7 @@ private:
std::set<ContractDefinition const*, ASTNode::CompareByID> m_subObjects;
langutil::DebugInfoSelection m_debugInfoSelection = langutil::DebugInfoSelection::Default();
langutil::DebugInfoSelection m_debugInfoSelection = {};
langutil::CharStreamProvider const* m_soliditySourceProvider = nullptr;
};

View File

@ -95,7 +95,12 @@ pair<string, string> IRGenerator::run(
{
string const ir = yul::reindent(generate(_contract, _cborMetadata, _otherYulSources));
yul::AssemblyStack asmStack(m_evmVersion, yul::AssemblyStack::Language::StrictAssembly, m_optimiserSettings);
yul::AssemblyStack asmStack(
m_evmVersion,
yul::AssemblyStack::Language::StrictAssembly,
m_optimiserSettings,
m_context.debugInfoSelection()
);
if (!asmStack.parseAndAnalyze("", ir))
{
string errorMessage;
@ -1103,6 +1108,7 @@ void IRGenerator::resetContext(ContractDefinition const& _contract, ExecutionCon
m_context.revertStrings(),
m_optimiserSettings,
m_context.sourceIndices(),
m_context.debugInfoSelection(),
m_context.soliditySourceProvider()
);
newContext.copyFunctionIDsFrom(m_context);

View File

@ -49,6 +49,7 @@ public:
RevertStrings _revertStrings,
OptimiserSettings _optimiserSettings,
std::map<std::string, unsigned> _sourceIndices,
langutil::DebugInfoSelection const& _debugInfoSelection,
langutil::CharStreamProvider const* _soliditySourceProvider
):
m_evmVersion(_evmVersion),
@ -59,6 +60,7 @@ public:
_revertStrings,
std::move(_optimiserSettings),
std::move(_sourceIndices),
_debugInfoSelection,
_soliditySourceProvider
),
m_utils(_evmVersion, m_context.revertStrings(), m_context.functionCollector())

View File

@ -271,6 +271,13 @@ void CompilerStack::setMetadataHash(MetadataHash _metadataHash)
m_metadataHash = _metadataHash;
}
void CompilerStack::selectDebugInfo(DebugInfoSelection _debugInfoSelection)
{
if (m_stackState >= CompilationSuccessful)
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Must select debug info components before compilation."));
m_debugInfoSelection = _debugInfoSelection;
}
void CompilerStack::addSMTLib2Response(h256 const& _hash, string const& _response)
{
if (m_stackState >= ParsedAndImported)
@ -882,7 +889,7 @@ string CompilerStack::assemblyString(string const& _contractName, StringMap cons
Contract const& currentContract = contract(_contractName);
if (currentContract.evmAssembly)
return currentContract.evmAssembly->assemblyString(DebugInfoSelection::Default(), _sourceCodes);
return currentContract.evmAssembly->assemblyString(m_debugInfoSelection, _sourceCodes);
else
return string();
}
@ -1319,7 +1326,7 @@ void CompilerStack::generateIR(ContractDefinition const& _contract)
for (auto const& pair: m_contracts)
otherYulSources.emplace(pair.second.contract, pair.second.yulIR);
IRGenerator generator(m_evmVersion, m_revertStrings, m_optimiserSettings, sourceIndices(), this);
IRGenerator generator(m_evmVersion, m_revertStrings, m_optimiserSettings, sourceIndices(), m_debugInfoSelection, this);
tie(compiledContract.yulIR, compiledContract.yulIROptimized) = generator.run(
_contract,
createCBORMetadata(compiledContract, /* _forIR */ true),
@ -1342,7 +1349,12 @@ void CompilerStack::generateEVMFromIR(ContractDefinition const& _contract)
return;
// Re-parse the Yul IR in EVM dialect
yul::AssemblyStack stack(m_evmVersion, yul::AssemblyStack::Language::StrictAssembly, m_optimiserSettings);
yul::AssemblyStack stack(
m_evmVersion,
yul::AssemblyStack::Language::StrictAssembly,
m_optimiserSettings,
m_debugInfoSelection
);
stack.parseAndAnalyze("", compiledContract.yulIROptimized);
stack.optimize();
@ -1369,7 +1381,12 @@ void CompilerStack::generateEwasm(ContractDefinition const& _contract)
return;
// Re-parse the Yul IR in EVM dialect
yul::AssemblyStack stack(m_evmVersion, yul::AssemblyStack::Language::StrictAssembly, m_optimiserSettings);
yul::AssemblyStack stack(
m_evmVersion,
yul::AssemblyStack::Language::StrictAssembly,
m_optimiserSettings,
m_debugInfoSelection
);
stack.parseAndAnalyze("", compiledContract.yulIROptimized);
stack.optimize();

View File

@ -35,10 +35,11 @@
#include <libsmtutil/SolverInterface.h>
#include <liblangutil/CharStreamProvider.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/ErrorReporter.h>
#include <liblangutil/EVMVersion.h>
#include <liblangutil/SourceLocation.h>
#include <liblangutil/CharStreamProvider.h>
#include <libevmasm/LinkerObject.h>
@ -203,6 +204,9 @@ public:
/// @param _metadataHash can be IPFS, Bzzr1, None
void setMetadataHash(MetadataHash _metadataHash);
/// Select components of debug info that should be included in comments in generated assembly.
void selectDebugInfo(langutil::DebugInfoSelection _debugInfoSelection);
/// Sets the sources. Must be set before parsing.
void setSources(StringMap _sources);
@ -505,6 +509,7 @@ private:
langutil::ErrorReporter m_errorReporter;
bool m_metadataLiteralSources = false;
MetadataHash m_metadataHash = MetadataHash::IPFS;
langutil::DebugInfoSelection m_debugInfoSelection = langutil::DebugInfoSelection::Default();
bool m_parserErrorRecovery = false;
State m_stackState = Empty;
bool m_importedSources = false;

View File

@ -28,9 +28,14 @@
#include <libyul/AssemblyStack.h>
#include <libyul/Exceptions.h>
#include <libyul/optimiser/Suite.h>
#include <liblangutil/SourceReferenceFormatter.h>
#include <libevmasm/Instruction.h>
#include <libsmtutil/Exceptions.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/SourceReferenceFormatter.h>
#include <libsolutil/JSON.h>
#include <libsolutil/Keccak256.h>
#include <libsolutil/CommonData.h>
@ -1358,7 +1363,8 @@ Json::Value StandardCompiler::compileYul(InputsAndSettings _inputsAndSettings)
AssemblyStack stack(
_inputsAndSettings.evmVersion,
AssemblyStack::Language::StrictAssembly,
_inputsAndSettings.optimiserSettings
_inputsAndSettings.optimiserSettings,
DebugInfoSelection::Default()
);
string const& sourceName = _inputsAndSettings.sources.begin()->first;
string const& sourceContents = _inputsAndSettings.sources.begin()->second;

View File

@ -304,14 +304,12 @@ string AsmPrinter::formatSourceLocation(
string AsmPrinter::formatDebugData(shared_ptr<DebugData const> const& _debugData, bool _statement)
{
DebugInfoSelection debugInfoSelection = DebugInfoSelection::Default();
if (!_debugData || debugInfoSelection.none())
if (!_debugData || m_debugInfoSelection.none())
return "";
vector<string> items;
if (auto id = _debugData->astID)
if (debugInfoSelection.astID)
if (m_debugInfoSelection.astID)
items.emplace_back("@ast-id " + to_string(*id));
if (
@ -324,7 +322,7 @@ string AsmPrinter::formatDebugData(shared_ptr<DebugData const> const& _debugData
items.emplace_back(formatSourceLocation(
_debugData->originLocation,
m_nameToSourceIndex,
debugInfoSelection,
m_debugInfoSelection,
m_soliditySourceProvider
));
}

View File

@ -49,9 +49,11 @@ public:
explicit AsmPrinter(
Dialect const* _dialect = nullptr,
std::optional<std::map<unsigned, std::shared_ptr<std::string const>>> _sourceIndexToName = {},
langutil::DebugInfoSelection const& _debugInfoSelection = langutil::DebugInfoSelection::Default(),
langutil::CharStreamProvider const* _soliditySourceProvider = nullptr
):
m_dialect(_dialect),
m_debugInfoSelection(_debugInfoSelection),
m_soliditySourceProvider(_soliditySourceProvider)
{
if (_sourceIndexToName)
@ -59,12 +61,12 @@ public:
m_nameToSourceIndex[*name] = index;
}
explicit AsmPrinter(
Dialect const& _dialect,
std::optional<std::map<unsigned, std::shared_ptr<std::string const>>> _sourceIndexToName = {},
langutil::DebugInfoSelection const& _debugInfoSelection = langutil::DebugInfoSelection::Default(),
langutil::CharStreamProvider const* _soliditySourceProvider = nullptr
): AsmPrinter(&_dialect, _sourceIndexToName, _soliditySourceProvider) {}
): AsmPrinter(&_dialect, _sourceIndexToName, _debugInfoSelection, _soliditySourceProvider) {}
std::string operator()(Literal const& _literal);
std::string operator()(Identifier const& _identifier);
@ -102,6 +104,7 @@ private:
Dialect const* const m_dialect = nullptr;
std::map<std::string, unsigned> m_nameToSourceIndex;
langutil::SourceLocation m_lastLocation = {};
langutil::DebugInfoSelection m_debugInfoSelection = {};
langutil::CharStreamProvider const* m_soliditySourceProvider = nullptr;
};

View File

@ -249,7 +249,7 @@ AssemblyStack::assembleWithDeployed(optional<string_view> _deployName) const
MachineAssemblyObject creationObject;
creationObject.bytecode = make_shared<evmasm::LinkerObject>(creationAssembly->assemble());
yulAssert(creationObject.bytecode->immutableReferences.empty(), "Leftover immutables.");
creationObject.assembly = creationAssembly->assemblyString();
creationObject.assembly = creationAssembly->assemblyString(m_debugInfoSelection);
creationObject.sourceMappings = make_unique<string>(
evmasm::AssemblyItem::computeSourceMapping(
creationAssembly->items(),
@ -261,7 +261,7 @@ AssemblyStack::assembleWithDeployed(optional<string_view> _deployName) const
if (deployedAssembly)
{
deployedObject.bytecode = make_shared<evmasm::LinkerObject>(deployedAssembly->assemble());
deployedObject.assembly = deployedAssembly->assemblyString();
deployedObject.assembly = deployedAssembly->assemblyString(m_debugInfoSelection);
deployedObject.sourceMappings = make_unique<string>(
evmasm::AssemblyItem::computeSourceMapping(
deployedAssembly->items(),
@ -314,11 +314,13 @@ AssemblyStack::assembleEVMWithDeployed(optional<string_view> _deployName) const
return {make_shared<evmasm::Assembly>(assembly), {}};
}
string AssemblyStack::print(CharStreamProvider const* _soliditySourceProvider) const
string AssemblyStack::print(
CharStreamProvider const* _soliditySourceProvider
) const
{
yulAssert(m_parserResult, "");
yulAssert(m_parserResult->code, "");
return m_parserResult->toString(&languageToDialect(m_language, m_evmVersion), _soliditySourceProvider) + "\n";
return m_parserResult->toString(&languageToDialect(m_language, m_evmVersion), m_debugInfoSelection, _soliditySourceProvider) + "\n";
}
shared_ptr<Object> AssemblyStack::parserResult() const

View File

@ -22,9 +22,10 @@
#pragma once
#include <liblangutil/CharStreamProvider.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/ErrorReporter.h>
#include <liblangutil/EVMVersion.h>
#include <liblangutil/CharStreamProvider.h>
#include <libyul/Object.h>
#include <libyul/ObjectParser.h>
@ -69,12 +70,24 @@ public:
enum class Machine { EVM, Ewasm };
AssemblyStack():
AssemblyStack(langutil::EVMVersion{}, Language::Assembly, solidity::frontend::OptimiserSettings::none())
AssemblyStack(
langutil::EVMVersion{},
Language::Assembly,
solidity::frontend::OptimiserSettings::none(),
langutil::DebugInfoSelection::Default()
)
{}
AssemblyStack(langutil::EVMVersion _evmVersion, Language _language, solidity::frontend::OptimiserSettings _optimiserSettings):
AssemblyStack(
langutil::EVMVersion _evmVersion,
Language _language,
solidity::frontend::OptimiserSettings _optimiserSettings,
langutil::DebugInfoSelection const& _debugInfoSelection
):
m_language(_language),
m_evmVersion(_evmVersion),
m_optimiserSettings(std::move(_optimiserSettings)),
m_debugInfoSelection(_debugInfoSelection),
m_errorReporter(m_errors)
{}
@ -116,7 +129,9 @@ public:
langutil::ErrorList const& errors() const { return m_errors; }
/// Pretty-print the input after having parsed it.
std::string print(langutil::CharStreamProvider const* _soliditySourceProvider = nullptr) const;
std::string print(
langutil::CharStreamProvider const* _soliditySourceProvider = nullptr
) const;
/// Return the parsed and analyzed object.
std::shared_ptr<Object> parserResult() const;
@ -132,6 +147,7 @@ private:
Language m_language = Language::Assembly;
langutil::EVMVersion m_evmVersion;
solidity::frontend::OptimiserSettings m_optimiserSettings;
langutil::DebugInfoSelection m_debugInfoSelection{};
std::unique_ptr<langutil::CharStream> m_charStream;

View File

@ -51,13 +51,14 @@ string indent(std::string const& _input)
}
string Data::toString(Dialect const*, CharStreamProvider const*) const
string Data::toString(Dialect const*, DebugInfoSelection const&, CharStreamProvider const*) const
{
return "data \"" + name.str() + "\" hex\"" + util::toHex(data) + "\"";
}
string Object::toString(
Dialect const* _dialect,
DebugInfoSelection const& _debugInfoSelection,
CharStreamProvider const* _soliditySourceProvider
) const
{
@ -74,10 +75,15 @@ string Object::toString(
})) +
"\n";
string inner = "code " + AsmPrinter{_dialect, debugData->sourceNames, _soliditySourceProvider}(*code);
string inner = "code " + AsmPrinter(
_dialect,
debugData->sourceNames,
_debugInfoSelection,
_soliditySourceProvider
)(*code);
for (auto const& obj: subObjects)
inner += "\n" + obj->toString(_dialect, _soliditySourceProvider);
inner += "\n" + obj->toString(_dialect, _debugInfoSelection, _soliditySourceProvider);
return useSrcComment + "object \"" + name.str() + "\" {\n" + indent(inner) + "\n}";
}

View File

@ -25,6 +25,7 @@
#include <libyul/YulString.h>
#include <liblangutil/CharStreamProvider.h>
#include <liblangutil/DebugInfoSelection.h>
#include <libsolutil/Common.h>
@ -54,6 +55,7 @@ struct ObjectNode
YulString name;
virtual std::string toString(
Dialect const* _dialect,
langutil::DebugInfoSelection const& _debugInfoSelection,
langutil::CharStreamProvider const* _soliditySourceProvider
) const = 0;
};
@ -69,6 +71,7 @@ struct Data: public ObjectNode
std::string toString(
Dialect const* _dialect,
langutil::DebugInfoSelection const& _debugInfoSelection,
langutil::CharStreamProvider const* _soliditySourceProvider
) const override;
};
@ -89,6 +92,7 @@ public:
/// @returns a (parseable) string representation.
std::string toString(
Dialect const* _dialect,
langutil::DebugInfoSelection const& _debugInfoSelection = langutil::DebugInfoSelection::Default(),
langutil::CharStreamProvider const* _soliditySourceProvider = nullptr
) const;

View File

@ -972,7 +972,8 @@ bool CommandLineInterface::assemble(yul::AssemblyStack::Language _language, yul:
auto& stack = assemblyStacks[src.first] = yul::AssemblyStack(
m_options.output.evmVersion,
_language,
m_options.optimiserSettings()
m_options.optimiserSettings(),
DebugInfoSelection::Default()
);
if (!stack.parseAndAnalyze(src.first, src.second))

View File

@ -28,6 +28,7 @@
#include <libyul/AssemblyStack.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/Exceptions.h>
#include <liblangutil/Scanner.h>
#include <liblangutil/SourceReferenceFormatter.h>
@ -59,7 +60,12 @@ std::optional<Error> parseAndReturnFirstError(
AssemblyStack::Machine _machine = AssemblyStack::Machine::EVM
)
{
AssemblyStack stack(solidity::test::CommonOptions::get().evmVersion(), _language, solidity::frontend::OptimiserSettings::none());
AssemblyStack stack(
solidity::test::CommonOptions::get().evmVersion(),
_language,
solidity::frontend::OptimiserSettings::none(),
DebugInfoSelection::None()
);
bool success = false;
try
{
@ -125,7 +131,12 @@ Error expectError(
void parsePrintCompare(string const& _source, bool _canWarn = false)
{
AssemblyStack stack(solidity::test::CommonOptions::get().evmVersion(), AssemblyStack::Language::Assembly, OptimiserSettings::none());
AssemblyStack stack(
solidity::test::CommonOptions::get().evmVersion(),
AssemblyStack::Language::Assembly,
OptimiserSettings::none(),
DebugInfoSelection::None()
);
BOOST_REQUIRE(stack.parseAndAnalyze("", _source));
if (_canWarn)
BOOST_REQUIRE(!Error::containsErrors(stack.errors()));
@ -210,7 +221,12 @@ BOOST_AUTO_TEST_CASE(print_string_literal_unicode)
{
string source = "{ let x := \"\\u1bac\" }";
string parsed = "object \"object\" {\n code { let x := \"\\xe1\\xae\\xac\" }\n}\n";
AssemblyStack stack(solidity::test::CommonOptions::get().evmVersion(), AssemblyStack::Language::Assembly, OptimiserSettings::none());
AssemblyStack stack(
solidity::test::CommonOptions::get().evmVersion(),
AssemblyStack::Language::Assembly,
OptimiserSettings::none(),
DebugInfoSelection::None()
);
BOOST_REQUIRE(stack.parseAndAnalyze("", source));
BOOST_REQUIRE(stack.errors().empty());
BOOST_CHECK_EQUAL(stack.print(), parsed);

View File

@ -23,6 +23,7 @@
#include <test/libsolidity/SolidityExecutionFramework.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/Exceptions.h>
#include <liblangutil/SourceReferenceFormatter.h>
@ -34,6 +35,7 @@
using namespace solidity;
using namespace solidity::frontend;
using namespace solidity::frontend::test;
using namespace solidity::langutil;
using namespace solidity::test;
using namespace std;
@ -94,8 +96,12 @@ bytes SolidityExecutionFramework::multiSourceCompileContract(
else if (forceEnableOptimizer)
optimiserSettings = OptimiserSettings::full();
yul::AssemblyStack
asmStack(m_evmVersion, yul::AssemblyStack::Language::StrictAssembly, optimiserSettings);
yul::AssemblyStack asmStack(
m_evmVersion,
yul::AssemblyStack::Language::StrictAssembly,
optimiserSettings,
DebugInfoSelection::All()
);
bool analysisSuccessful = asmStack.parseAndAnalyze("", m_compiler.yulIROptimized(contractName));
solAssert(analysisSuccessful, "Code that passed analysis in CompilerStack can't have errors");

View File

@ -31,6 +31,7 @@
#include <libyul/backends/evm/EVMDialect.h>
#include <libyul/backends/wasm/WasmDialect.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/ErrorReporter.h>
#include <liblangutil/Scanner.h>
#include <liblangutil/SourceReferenceFormatter.h>
@ -59,7 +60,8 @@ pair<shared_ptr<Block>, shared_ptr<yul::AsmAnalysisInfo>> yul::test::parse(strin
_yul ? AssemblyStack::Language::Yul : AssemblyStack::Language::StrictAssembly,
solidity::test::CommonOptions::get().optimize ?
solidity::frontend::OptimiserSettings::standard() :
solidity::frontend::OptimiserSettings::minimal()
solidity::frontend::OptimiserSettings::minimal(),
DebugInfoSelection::All()
);
if (!stack.parseAndAnalyze("", _source) || !stack.errors().empty())
BOOST_FAIL("Invalid source.");

View File

@ -47,7 +47,12 @@ TestCase::TestResult EVMCodeTransformTest::run(ostream& _stream, string const& _
solidity::frontend::OptimiserSettings settings = solidity::frontend::OptimiserSettings::none();
settings.runYulOptimiser = false;
settings.optimizeStackAllocation = m_stackOpt;
AssemblyStack stack(EVMVersion{}, AssemblyStack::Language::StrictAssembly, settings);
AssemblyStack stack(
EVMVersion{},
AssemblyStack::Language::StrictAssembly,
settings,
DebugInfoSelection::All()
);
if (!stack.parseAndAnalyze("", m_source))
{
AnsiColorized(_stream, _formatted, {formatting::BOLD, formatting::RED}) << _linePrefix << "Error parsing source." << endl;

View File

@ -30,6 +30,7 @@
#include <libyul/AST.h>
#include <libyul/Object.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/ErrorReporter.h>
#include <liblangutil/SourceReferenceFormatter.h>
@ -82,7 +83,8 @@ bool EwasmTranslationTest::parse(ostream& _stream, string const& _linePrefix, bo
m_stack = AssemblyStack(
solidity::test::CommonOptions::get().evmVersion(),
AssemblyStack::Language::StrictAssembly,
solidity::frontend::OptimiserSettings::none()
solidity::frontend::OptimiserSettings::none(),
DebugInfoSelection::All()
);
if (m_stack.parseAndAnalyze("", m_source))
{

View File

@ -26,6 +26,7 @@
#include <libevmasm/Instruction.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/SourceReferenceFormatter.h>
#include <boost/algorithm/string.hpp>
@ -64,7 +65,8 @@ TestCase::TestResult ObjectCompilerTest::run(ostream& _stream, string const& _li
AssemblyStack stack(
EVMVersion(),
m_wasm ? AssemblyStack::Language::Ewasm : AssemblyStack::Language::StrictAssembly,
OptimiserSettings::preset(m_optimisationPreset)
OptimiserSettings::preset(m_optimisationPreset),
DebugInfoSelection::All()
);
if (!stack.parseAndAnalyze("source", m_source))
{

View File

@ -23,6 +23,7 @@
#include <test/libsolidity/ErrorCheck.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/Scanner.h>
#include <libyul/AssemblyStack.h>
@ -60,7 +61,8 @@ pair<bool, ErrorList> parse(string const& _source)
AssemblyStack asmStack(
solidity::test::CommonOptions::get().evmVersion(),
AssemblyStack::Language::StrictAssembly,
solidity::frontend::OptimiserSettings::none()
solidity::frontend::OptimiserSettings::none(),
DebugInfoSelection::All()
);
bool success = asmStack.parseAndAnalyze("source", _source);
return {success, asmStack.errors()};
@ -181,7 +183,8 @@ BOOST_AUTO_TEST_CASE(to_string)
AssemblyStack asmStack(
solidity::test::CommonOptions::get().evmVersion(),
AssemblyStack::Language::StrictAssembly,
solidity::frontend::OptimiserSettings::none()
solidity::frontend::OptimiserSettings::none(),
DebugInfoSelection::All()
);
BOOST_REQUIRE(asmStack.parseAndAnalyze("source", code));
BOOST_CHECK_EQUAL(asmStack.print(), expectation);

View File

@ -26,6 +26,7 @@
#include <libyul/AssemblyStack.h>
#include <libyul/AsmAnalysisInfo.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/ErrorReporter.h>
#include <liblangutil/SourceReferenceFormatter.h>
@ -67,7 +68,8 @@ bool YulInterpreterTest::parse(ostream& _stream, string const& _linePrefix, bool
AssemblyStack stack(
solidity::test::CommonOptions::get().evmVersion(),
AssemblyStack::Language::StrictAssembly,
solidity::frontend::OptimiserSettings::none()
solidity::frontend::OptimiserSettings::none(),
DebugInfoSelection::All()
);
if (stack.parseAndAnalyze("", m_source))
{

View File

@ -23,6 +23,8 @@
#include <libsolidity/interface/OptimiserSettings.h>
#include <liblangutil/DebugInfoSelection.h>
namespace solidity::test::fuzzer
{
class YulAssembler
@ -36,7 +38,8 @@ public:
m_stack(
_version,
solidity::yul::AssemblyStack::Language::StrictAssembly,
_optSettings
_optSettings,
langutil::DebugInfoSelection::All()
),
m_yulProgram(_yulSource),
m_optimiseYul(_optSettings.runYulOptimiser)

View File

@ -19,6 +19,7 @@
#include <libyul/AssemblyStack.h>
#include <libyul/backends/evm/EVMCodeTransform.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/EVMVersion.h>
using namespace solidity;
@ -39,7 +40,8 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size)
AssemblyStack stack(
langutil::EVMVersion(),
AssemblyStack::Language::StrictAssembly,
solidity::frontend::OptimiserSettings::full()
solidity::frontend::OptimiserSettings::full(),
langutil::DebugInfoSelection::All()
);
if (!stack.parseAndAnalyze("source", input))

View File

@ -22,6 +22,7 @@
#include <libyul/backends/evm/EVMDialect.h>
#include <libyul/AssemblyStack.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/Exceptions.h>
#include <liblangutil/EVMVersion.h>
@ -61,7 +62,8 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size)
AssemblyStack stack(
langutil::EVMVersion(),
AssemblyStack::Language::StrictAssembly,
solidity::frontend::OptimiserSettings::full()
solidity::frontend::OptimiserSettings::full(),
DebugInfoSelection::All()
);
try
{

View File

@ -17,9 +17,12 @@
// SPDX-License-Identifier: GPL-3.0
#include <libyul/AssemblyStack.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/EVMVersion.h>
using namespace solidity;
using namespace solidity::langutil;
using namespace solidity::util;
using namespace solidity::yul;
using namespace std;
@ -38,7 +41,8 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size)
AssemblyStack stack(
langutil::EVMVersion(),
AssemblyStack::Language::StrictAssembly,
solidity::frontend::OptimiserSettings::full()
solidity::frontend::OptimiserSettings::full(),
DebugInfoSelection::All()
);
if (!stack.parseAndAnalyze("source", input))

View File

@ -30,6 +30,7 @@
#include <libyul/backends/evm/EVMDialect.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/EVMVersion.h>
#include <src/libfuzzer/libfuzzer_macro.h>
@ -64,7 +65,8 @@ DEFINE_PROTO_FUZZER(Program const& _input)
AssemblyStack stack(
version,
AssemblyStack::Language::StrictAssembly,
solidity::frontend::OptimiserSettings::full()
solidity::frontend::OptimiserSettings::full(),
DebugInfoSelection::All()
);
// Parse protobuf mutated YUL code

View File

@ -30,6 +30,7 @@
#include <libyul/backends/evm/EVMDialect.h>
#include <libyul/Exceptions.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/EVMVersion.h>
#include <liblangutil/SourceReferenceFormatter.h>
@ -63,7 +64,8 @@ DEFINE_PROTO_FUZZER(Program const& _input)
AssemblyStack stack(
version,
AssemblyStack::Language::StrictAssembly,
solidity::frontend::OptimiserSettings::full()
solidity::frontend::OptimiserSettings::full(),
DebugInfoSelection::All()
);
// Parse protobuf mutated YUL code

View File

@ -27,6 +27,7 @@
#include <libyul/backends/evm/EVMDialect.h>
#include <libyul/AssemblyStack.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/Exceptions.h>
#include <liblangutil/EVMVersion.h>
#include <liblangutil/SourceReferenceFormatter.h>
@ -58,7 +59,8 @@ pair<shared_ptr<Block>, shared_ptr<AsmAnalysisInfo>> parse(string const& _source
AssemblyStack stack(
langutil::EVMVersion(),
AssemblyStack::Language::StrictAssembly,
solidity::frontend::OptimiserSettings::none()
solidity::frontend::OptimiserSettings::none(),
DebugInfoSelection::Default()
);
if (stack.parseAndAnalyze("--INPUT--", _source))
{