Details
- Reviewers
dblaikie - Commits
- rG068332978c67: [Demangle][Rust] Parse named types
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/include/llvm/Demangle/RustDemangle.h | ||
---|---|---|
86–87 | Could use a custom enum parameter here to avoid having to add a comment at every call site. | |
llvm/lib/Demangle/RustDemangle.cpp | ||
424–437 | Perhaps it'd be more appropriate to use look() here, then consume() in the if block below? | |
429–435 | Rather than special casing a bunch of things here - especially if the consume->look change makes sense - could this code here use demanglePath unconditionally and let errors fall out of that naturally? (it'd match the grammar more closely, I think - avoid needing the implementation of <path> mixed up in the implementation of <type>) I guess maybe that's not feasible - if some invalid basic type could then be interpreted as a path, even though it should be an invalid basic type instead? | |
llvm/test/Demangle/rust.test | ||
141 | These tests for <type> are using inherited impl whereas I think previous tests for <type> were using generic args. It'd be nice if they were consistent, I think? (so as not to raise questions/confusion about whether the context in which the type appears is significant to the testing of the type rule) (I don't mind which way they are consistent - if you'd rather change the previous tests over to use inherited impl so they're consistent with the new tests, or chan these new ones to use generic args - or both to some third thing (changing existing tests should be done in a preliminary/separate commit, though)) |
- Fall back to the path production without special casing.
- Use an enum for InType.
- Use generic arguments in tests instead of an inherent impl.
llvm/lib/Demangle/RustDemangle.cpp | ||
---|---|---|
424–437 | In context of this changes using look() instead of consume() seems like an improvement, and I changed it accordingly. Admittedly I will return to the previous approach when introducing additional type productions since each would have to consume the initial character otherwise. | |
llvm/test/Demangle/rust.test | ||
141 | Replaced with generic arguments for consistency. As additional benefit it emphasizes the distinction between demangling of generic arguments outside types where :: is included, and in types where it is omitted. |
Could use a custom enum parameter here to avoid having to add a comment at every call site.