v0: replace skip_* methods with print_* methods in a "skip printing" mode.#53
Merged
alexcrichton merged 3 commits intorust-lang:mainfrom Jul 20, 2021
Merged
Conversation
Member
|
Seems reasonable to me! |
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.
My motivation for this change is that I wanted to implement structural constant value demangling (for rust-lang/rust#87194) and having to implement both
skip_constandprint_constfor the new constant values seemed redundant, and also potentially risky (i.e. the two could go out of sync).FWIW, the C demangler I wrote for
libibertyjust doesn't have this problem, as it took the "skip printing" route from the start, and I believe other implementations do something similar as well.While the
print_*methods may be less efficient when theoutfield isNone, than the oldskip_*implementation, I don't think the performance difference warrants dealing with the maintenance burden of duplication.Worst case, if performance does become a concern, we can make
Printergeneric over a type that provides theOption<&mut fmt::Formatter>through a method, which could let LLVM optimizeprint_*methods to be more or less the same as the oldskip_*methods (forPrinter<SkipFmt>).