[llvm] 9fa1380 - [Demangle][Rust] Parse trait implementations
    Tomasz Miąsko via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Sat May 15 14:57:03 PDT 2021
    
    
  
Author: Tomasz Miąsko
Date: 2021-05-15T23:52:25+02:00
New Revision: 9fa138009f0a818bd2c154f8cd83a98265122714
URL: https://github.com/llvm/llvm-project/commit/9fa138009f0a818bd2c154f8cd83a98265122714
DIFF: https://github.com/llvm/llvm-project/commit/9fa138009f0a818bd2c154f8cd83a98265122714.diff
LOG: [Demangle][Rust] Parse trait implementations
Part of https://reviews.llvm.org/D102549
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 223d815aa4a8..7df2ec8e77aa 100644
--- a/llvm/lib/Demangle/RustDemangle.cpp
+++ b/llvm/lib/Demangle/RustDemangle.cpp
@@ -153,6 +153,15 @@ void Demangler::demanglePath() {
     print(">");
     break;
   }
+  case 'X': {
+    demangleImplPath();
+    print("<");
+    demangleType();
+    print(" as ");
+    demanglePath();
+    print(">");
+    break;
+  }
   case 'N': {
     char NS = consume();
     if (!isLower(NS) && !isUpper(NS)) {
diff  --git a/llvm/test/Demangle/rust.test b/llvm/test/Demangle/rust.test
index c1ba4774faa5..f69156bc5500 100644
--- a/llvm/test/Demangle/rust.test
+++ b/llvm/test/Demangle/rust.test
@@ -41,6 +41,14 @@ CHECK: <_>
 CHECK: <_>
        _RMs_C5cratep
 
+; Trait impl
+
+CHECK: <_ as Clone>
+       _RXC5cratepC5Clone
+
+CHECK: <_ as Clone>
+       _RXs_C5cratepC5Clone
+
 ; Generic type arguments
 
 CHECK: generic::<_>
        
    
    
More information about the llvm-commits
mailing list