[llvm] 774de7a - [Demangle][Rust] Parse tuples

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


Author: Tomasz Miąsko
Date: 2021-05-19T00:04:42+02:00
New Revision: 774de7a09bee2e21f3cd7d8f8a001d83e2654483

URL: https://github.com/llvm/llvm-project/commit/774de7a09bee2e21f3cd7d8f8a001d83e2654483
DIFF: https://github.com/llvm/llvm-project/commit/774de7a09bee2e21f3cd7d8f8a001d83e2654483.diff

LOG: [Demangle][Rust] Parse tuples

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D102579

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Demangle/RustDemangle.cpp b/llvm/lib/Demangle/RustDemangle.cpp
index 62f27ee9ecd5..9370032b8d8e 100644
--- a/llvm/lib/Demangle/RustDemangle.cpp
+++ b/llvm/lib/Demangle/RustDemangle.cpp
@@ -441,6 +441,19 @@ void Demangler::demangleType() {
     demangleType();
     print("]");
     break;
+  case 'T': {
+    print("(");
+    size_t I = 0;
+    for (; !Error && !consumeIf('E'); ++I) {
+      if (I > 0)
+        print(", ");
+      demangleType();
+    }
+    if (I == 1)
+      print(",");
+    print(")");
+    break;
+  }
   default:
     Position = Start;
     demanglePath(InType::Yes);

diff  --git a/llvm/test/Demangle/rust.test b/llvm/test/Demangle/rust.test
index 5a2dc8f9a8a9..9fe17154c4c9 100644
--- a/llvm/test/Demangle/rust.test
+++ b/llvm/test/Demangle/rust.test
@@ -163,6 +163,18 @@ CHECK: types::<[u8; 0]>
 CHECK: types::<[_]>
        _RIC5typesSpE
 
+CHECK: types::<()>
+       _RIC5typesTEE
+
+CHECK: types::<(_,)>
+       _RIC5typesTpEE
+
+CHECK: types::<(_, _)>
+       _RIC5typesTppEE
+
+CHECK: types::<(_, _, _)>
+       _RIC5typesTpppEE
+
 ; Integer constants. Test value demangling.
 
 CHECK: integer::<0>


        


More information about the llvm-commits mailing list