[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
Mon Sep 27 13:00:16 PDT 2021
ljmf00 created this revision.
ljmf00 created this object with edit policy "Administrators".
Herald added a reviewer: jhenderson.
ljmf00 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This is part of https://github.com/dlang/projects/issues/81
Enable support for demangling D symbols using llvm-cxxfilt tool
Signed-off-by: Luís Ferreira <contact at lsferreira.net>
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,10 @@
+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()
+ _D8demangle4testFZv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110577.375378.patch
Type: text/x-patch
Size: 1157 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210927/7ad30408/attachment.bin>
More information about the llvm-commits
mailing list