[PATCH] D102573: [Demangle][Rust] Parse array type

Tomasz Miąsko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 18 15:12:42 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
tmiasko marked an inline comment as done.
Closed by commit rGb42400ccf3be: [Demangle][Rust] Parse array type (authored by tmiasko).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102573/new/

https://reviews.llvm.org/D102573

Files:
  llvm/lib/Demangle/RustDemangle.cpp
  llvm/test/Demangle/rust.test


Index: llvm/test/Demangle/rust.test
===================================================================
--- llvm/test/Demangle/rust.test
+++ llvm/test/Demangle/rust.test
@@ -155,6 +155,11 @@
 CHECK: named::<Name<>>
        _RIC5namedIC4NameEE
 
+; Types
+
+CHECK: types::<[u8; 0]>
+       _RIC5typesAhj0_E
+
 ; Integer constants. Test value demangling.
 
 CHECK: integer::<0>
Index: llvm/lib/Demangle/RustDemangle.cpp
===================================================================
--- llvm/lib/Demangle/RustDemangle.cpp
+++ llvm/lib/Demangle/RustDemangle.cpp
@@ -421,14 +421,26 @@
 //          | "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>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102573.346282.patch
Type: text/x-patch
Size: 1263 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210518/c4c4ea39/attachment.bin>


More information about the llvm-commits mailing list