[PATCH] D110577: [llvm-cxxfilt] Enable support for D programming language demangling

Luís Ferreira via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 8 08:57:15 PDT 2021


ljmf00 updated this revision to Diff 378260.

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

https://reviews.llvm.org/D110577

Files:
  llvm/test/Demangle/dlang.test
  llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp


Index: llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
===================================================================
--- llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
+++ llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
@@ -18,6 +18,7 @@
 #include "llvm/Support/WithColor.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cstdlib>
+#include <cstring>
 #include <iostream>
 
 using namespace llvm;
@@ -92,6 +93,11 @@
     Undecorated = rustDemangle(DecoratedStr, nullptr, nullptr, &Status);
   }
 
+  if (!Undecorated &&
+      (DecoratedLength >= 2 && strncmp(DecoratedStr, "_D", 2) == 0)) {
+    Undecorated = dlangDemangle(DecoratedStr);
+  }
+
   std::string Result(Undecorated ? Prefix + Undecorated : Mangled);
   free(Undecorated);
   return Result;
Index: llvm/test/Demangle/dlang.test
===================================================================
--- /dev/null
+++ llvm/test/Demangle/dlang.test
@@ -0,0 +1,13 @@
+RUN: llvm-cxxfilt -n  < %s | FileCheck --match-full-lines %s
+
+; Full test suite for dlang demangling at
+; llvm/unittests/Demangle/DLangDemangleTest.cpp
+
+CHECK: D main
+       _Dmain
+
+CHECK: demangle.test
+       _D8demangle4testZ
+
+CHECK: _DDD
+       _DDD


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110577.378260.patch
Type: text/x-patch
Size: 1181 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211008/633b4e98/attachment.bin>


More information about the llvm-commits mailing list