Keep original label names from C code #415
Merged
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.
I have added an
Option<Rc<str>>
field to thecfg::Label::FromC
. This allows to preserve the names of blocks which are provided in the C source, potentially increasing the readability of transpiled code and making it easier to match original and transpiled code blocks. The label names are used as control flow variable values when--ddebug-labels
is enabled. Unfortunately, Relooper really likes to dump those names in the_
branch of matches, bringing the automatic label names to the front. Still, there are some situations where the old labels can be traced in the transpiled code. This will also significantly increase readability if Relooper is changed to use labeled blocks & breaks instead of a match on variable: the C label names can be directly used as block label names.I had to make Label non-Copy. This is not a painful transition, and arguably there was no reason to make it Copy in the first place, since it was likely to carry some non-Copy data.