-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding source location support to AssemblyStack #8378
Conversation
623c8b0
to
47a1af7
Compare
434f929
to
aef75a0
Compare
libyul/AssemblyStack.cpp
Outdated
@@ -204,6 +204,7 @@ MachineAssemblyObject AssemblyStack::assemble(Machine _machine) const | |||
compileEVM(adapter, false, m_optimiserSettings.optimizeStackAllocation); | |||
object.bytecode = make_shared<evmasm::LinkerObject>(assembly.assemble()); | |||
object.assembly = assembly.assemblyString(); | |||
object.sourceMappings = make_unique<string>(evmasm::AssemblyItem::computeSourceMapping(assembly.items())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be better to pass {scanner().charStream()->name(), 0}
as source indices here and remove the special case for empty source indices in computeSourceMapping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(of course check that charStream()
is not null and maybe use ""
in that case for the source name).
aef75a0
to
1a1568b
Compare
liblangutil/Scanner.h
Outdated
@@ -98,6 +98,7 @@ class Scanner | |||
std::string const& source() const noexcept { return m_source->source(); } | |||
|
|||
std::shared_ptr<CharStream> charStream() noexcept { return m_source; } | |||
std::shared_ptr<CharStream> const& constCharStream() const noexcept { return m_source; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be
std::shared_ptr<CharStream> const& constCharStream() const noexcept { return m_source; } | |
std::shared_ptr<CharStream const> constCharStream() const noexcept { return m_source; } |
instead?
liblangutil/Scanner.h
Outdated
@@ -98,6 +98,7 @@ class Scanner | |||
std::string const& source() const noexcept { return m_source->source(); } | |||
|
|||
std::shared_ptr<CharStream> charStream() noexcept { return m_source; } | |||
std::shared_ptr<CharStream> const& constCharStream() const noexcept { return m_source; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be
std::shared_ptr<CharStream> const& constCharStream() const noexcept { return m_source; } | |
std::shared_ptr<CharStream const> charStream() const noexcept { return m_source; } |
instead?
liblangutil/Scanner.h
Outdated
@@ -98,6 +98,7 @@ class Scanner | |||
std::string const& source() const noexcept { return m_source->source(); } | |||
|
|||
std::shared_ptr<CharStream> charStream() noexcept { return m_source; } | |||
std::shared_ptr<CharStream> const& constCharStream() const noexcept { return m_source; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be
std::shared_ptr<CharStream> const& constCharStream() const noexcept { return m_source; } | |
std::shared_ptr<CharStream const> charStream() const noexcept { return m_source; } |
instead?
1a1568b
to
ec083c4
Compare
can we make this option available in the cli as well? |
Fixes #7783
Description
Checklist