-
Couldn't load subscription status.
- Fork 4
Implement const generics and allow .llvm.<hash> suffixes #2
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
Conversation
| case 'b': { | ||
| uint64_t value = 0; | ||
| size_t hex_len = 0; | ||
| while (!eat(rdm, '_')) { | ||
| value <<= 4; | ||
|
|
||
| char c = next(rdm); | ||
| if (IS_DIGIT(c)) | ||
| value |= c - '0'; | ||
| else if (c >= 'a' && c <= 'f') | ||
| value |= 10 + (c - 'a'); | ||
| else | ||
| ERROR_AND(return ); | ||
| hex_len++; | ||
| } | ||
|
|
||
| if (value == 0) { | ||
| PRINT("false"); | ||
| } else if (value == 1) { | ||
| PRINT("true"); | ||
| } else { | ||
| ERROR_AND(return ); | ||
| } | ||
| break; | ||
| } |
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.
Don't we require b0_ and b1_? Oh, no, we don't, that got changed with try_parse_uint.
And demangle_const_uint doesn't have a try_parse_uint because of how it handles hex fallback, ugh.
rust-demangle.c
Outdated
|
|
||
| PRINT("\""); | ||
|
|
||
| // FIXME(bjorn3) actually decode UTF-8 strings into individual characters |
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.
What's kind of funny is that 1. try_parse_str_chars in the Rust version barely and 2. there's a UTF-8 encoder somewhere in this file, for punycode, so I feel like combining the two (the encoder giving you the mapping of the bits to bytes) might not even be that hard. And we have test data, so I can golf it if you want.
| * this arguably also includes `p` as an *untyped* placeholder constant | ||
| * **(UNPORTED)** [`str` and structural constants](https://github.com/rust-lang/rfcs/pull/3161) | ||
| (only usable in `const` generics on unstable Rust) | ||
| * symbol prefix flexibility (`__R` and `R`, instead of `_R`) |
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.
This one has been allowed since the first commit of rustc-demangle adding the v0 demangler.
|
Added UTF-8 decoding, but no "is printable" heuristic, a lot of that data is somewhat uniform but being 100% exact is very annoying (and would require trying various "compressed lookup" tricks that I don't have time for). Thanks for doing all this work, and sorry I didn't see it sooner! (and that I didn't finish this port myself...) |
LykenSol/rust-demangle.c#2 has been merged. The main change from the PR as of me vendoring it is new support for decoding and escaping UTF-8 string literals. In addition clang-format was used for formatting the file.
These are all necessary to demangle symbols for rustc profiles.