aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Demangle/RustDemangle.cpp
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2021-05-18 18:14:02 +0200
committerTomasz Miąsko <tomasz.miasko@gmail.com>2021-05-19 00:04:41 +0200
commitb42400ccf3be9c8a422f175e16109e358298973c (patch)
treedde9d3aacf4e3769a26ddcf5043925abba492407 /llvm/lib/Demangle/RustDemangle.cpp
parent068332978c672afb7504b2d2856d0df9010f27bf (diff)
downloadllvm-b42400ccf3be9c8a422f175e16109e358298973c.zip
llvm-b42400ccf3be9c8a422f175e16109e358298973c.tar.gz
llvm-b42400ccf3be9c8a422f175e16109e358298973c.tar.bz2
[Demangle][Rust] Parse array type
Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D102573
Diffstat (limited to 'llvm/lib/Demangle/RustDemangle.cpp')
-rw-r--r--llvm/lib/Demangle/RustDemangle.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/llvm/lib/Demangle/RustDemangle.cpp b/llvm/lib/Demangle/RustDemangle.cpp
index 6e2694f..77aa4f7 100644
--- a/llvm/lib/Demangle/RustDemangle.cpp
+++ b/llvm/lib/Demangle/RustDemangle.cpp
@@ -421,14 +421,26 @@ void Demangler::printBasicType(BasicType Type) {
// | "D" <dyn-bounds> <lifetime> // dyn Trait<Assoc = X> + Send + 'a
// | <backref> // backref
void Demangler::demangleType() {
- char C = look();
+ size_t Start = Position;
+
+ char C = consume();
BasicType Type;
- if (parseBasicType(C, Type)) {
- consume();
+ if (parseBasicType(C, Type))
return printBasicType(Type);
- }
- demanglePath(InType::Yes);
+ switch (C) {
+ case 'A':
+ print("[");
+ demangleType();
+ print("; ");
+ demangleConst();
+ print("]");
+ break;
+ default:
+ Position = Start;
+ demanglePath(InType::Yes);
+ break;
+ }
}
// <const> = <basic-type> <const-data>