c-writer.cc: Eliminate GetGlobalName (NFC)#2041
Merged
Conversation
sbc100
approved these changes
Nov 5, 2022
src/c-writer.cc
Outdated
| assert(global_sym_map_.count(name.name) == 1); | ||
| auto iter = global_sym_map_.find(name.name); | ||
| assert(iter != global_sym_map_.end()); | ||
| Write(iter->second); |
Member
There was a problem hiding this comment.
Would it be enough to just do Write(global_sym_map_.at(name.name)) should be enough here.. no need for count or find maybe?
I guess this is existing code though, so might not make sense as part of this change.
Member
Author
There was a problem hiding this comment.
Sure, that works fine for now. We can worry about how much defensive programming is worthwhile in the next one.
matthias-blume
pushed a commit
to matthias-blume/wabt
that referenced
this pull request
Dec 16, 2022
Require all resolution of GlobalNames to happen in one place (Write(GlobalName)). Also eliminate AddressOf, Deref, GlobalVar. This is a step towards fixing WebAssembly#2034 (split out from WebAssembly#2035).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Require all resolution of GlobalNames to happen in one place (Write(GlobalName)). Also eliminate AddressOf, Deref, GlobalVar.
This is a step towards fixing #2034 (split out from #2035).