Pass DebugInfoSelection down to the code handling assembly printing

This commit is contained in:
Kamil Śliwak
2021-10-11 20:34:48 +02:00
parent f7c4ed849d
commit bcfefc79d9
28 changed files with 170 additions and 47 deletions
+19 -3
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);
@@ -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");