aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/clang/llvm-cxxfilt
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/clang/llvm-cxxfilt')
-rw-r--r--usr.bin/clang/llvm-cxxfilt/Makefile30
-rw-r--r--usr.bin/clang/llvm-cxxfilt/Makefile.depend23
-rw-r--r--usr.bin/clang/llvm-cxxfilt/llvm-cxxfilt-driver.cpp18
-rw-r--r--usr.bin/clang/llvm-cxxfilt/llvm-cxxfilt.1117
4 files changed, 188 insertions, 0 deletions
diff --git a/usr.bin/clang/llvm-cxxfilt/Makefile b/usr.bin/clang/llvm-cxxfilt/Makefile
new file mode 100644
index 000000000000..f9621da8da89
--- /dev/null
+++ b/usr.bin/clang/llvm-cxxfilt/Makefile
@@ -0,0 +1,30 @@
+.include <src.opts.mk>
+
+PROG_CXX= llvm-cxxfilt
+
+SRCDIR= llvm/tools/llvm-cxxfilt
+SRCS+= llvm-cxxfilt-driver.cpp
+SRCS+= llvm-cxxfilt.cpp
+
+.include "${SRCTOP}/lib/clang/llvm.pre.mk"
+
+CFLAGS+= -I${.OBJDIR}
+
+INCFILE= Opts.inc
+TDFILE= ${LLVM_BASE}/${SRCDIR}/Opts.td
+GENOPT= -gen-opt-parser-defs
+${INCFILE}: ${TDFILE}
+ ${LLVM_TBLGEN} ${GENOPT} -I ${LLVM_SRCS}/include -d ${.TARGET:C/$/.d/} \
+ -o ${.TARGET} ${TDFILE}
+TGHDRS+= ${INCFILE}
+
+DEPENDFILES+= ${TGHDRS:C/$/.d/}
+DPSRCS+= ${TGHDRS}
+CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/}
+
+.if ${MK_LLVM_CXXFILT} != "no"
+LINKS= ${BINDIR}/llvm-cxxfilt ${BINDIR}/c++filt
+MLINKS= llvm-cxxfilt.1 c++filt.1
+.endif
+
+.include "../llvm.prog.mk"
diff --git a/usr.bin/clang/llvm-cxxfilt/Makefile.depend b/usr.bin/clang/llvm-cxxfilt/Makefile.depend
new file mode 100644
index 000000000000..73df5dd192a7
--- /dev/null
+++ b/usr.bin/clang/llvm-cxxfilt/Makefile.depend
@@ -0,0 +1,23 @@
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/clang/libllvm \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libcxxrt \
+ lib/libthr \
+ lib/libz \
+ lib/msun \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/clang/llvm-cxxfilt/llvm-cxxfilt-driver.cpp b/usr.bin/clang/llvm-cxxfilt/llvm-cxxfilt-driver.cpp
new file mode 100644
index 000000000000..969ef2c6412e
--- /dev/null
+++ b/usr.bin/clang/llvm-cxxfilt/llvm-cxxfilt-driver.cpp
@@ -0,0 +1,18 @@
+//===-- driver-template.cpp -----------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Support/LLVMDriver.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/Support/InitLLVM.h"
+
+int llvm_cxxfilt_main(int argc, char **, const llvm::ToolContext &);
+
+int main(int argc, char **argv) {
+ llvm::InitLLVM X(argc, argv);
+ return llvm_cxxfilt_main(argc, argv, {argv[0], nullptr, false});
+}
diff --git a/usr.bin/clang/llvm-cxxfilt/llvm-cxxfilt.1 b/usr.bin/clang/llvm-cxxfilt/llvm-cxxfilt.1
new file mode 100644
index 000000000000..133ed151f0aa
--- /dev/null
+++ b/usr.bin/clang/llvm-cxxfilt/llvm-cxxfilt.1
@@ -0,0 +1,117 @@
+.\" Man page generated from reStructuredText.
+.
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
+..
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
+..
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
+..
+.TH "LLVM-CXXFILT" "1" "2023-05-24" "16" "LLVM"
+.SH NAME
+llvm-cxxfilt \- LLVM symbol name demangler
+.SH SYNOPSIS
+.sp
+\fBllvm\-cxxfilt\fP [\fIoptions\fP] [\fImangled names...\fP]
+.SH DESCRIPTION
+.sp
+\fBllvm\-cxxfilt\fP is a symbol demangler that can be used as a replacement
+for the GNU \fBc++filt\fP tool. It takes a series of symbol names and
+prints their demangled form on the standard output stream. If a name cannot be
+demangled, it is simply printed as is.
+.sp
+If no names are specified on the command\-line, names are read interactively from
+the standard input stream. When reading names from standard input, each input
+line is split on characters that are not part of valid Itanium name manglings,
+i.e. characters that are not alphanumeric, \(aq.\(aq, \(aq$\(aq, or \(aq_\(aq. Separators between
+names are copied to the output as is.
+.SH EXAMPLE
+.INDENT 0.0
+.INDENT 3.5
+.sp
+.nf
+.ft C
+$ llvm\-cxxfilt _Z3foov _Z3bari not_mangled
+foo()
+bar(int)
+not_mangled
+$ cat input.txt
+| _Z3foov *** _Z3bari *** not_mangled |
+$ llvm\-cxxfilt < input.txt
+| foo() *** bar(int) *** not_mangled |
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.SH OPTIONS
+.INDENT 0.0
+.TP
+.B \-\-format=<value>, \-s
+Mangling scheme to assume. Valid values are \fBauto\fP (default, auto\-detect the
+style) and \fBgnu\fP (assume GNU/Itanium style).
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-help, \-h
+Print a summary of command line options.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-no\-strip\-underscore, \-n
+Do not strip a leading underscore. This is the default for all platforms
+except Mach\-O based hosts.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-strip\-underscore, \-_
+Strip a single leading underscore, if present, from each input name before
+demangling. On by default on Mach\-O based platforms.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-types, \-t
+Attempt to demangle names as type names as well as function names.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-version
+Display the version of the \fBllvm\-cxxfilt\fP executable.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B @<FILE>
+Read command\-line options from response file \fI<FILE>\fP\&.
+.UNINDENT
+.SH EXIT STATUS
+.sp
+\fBllvm\-cxxfilt\fP returns 0 unless it encounters a usage error, in which
+case a non\-zero exit code is returned.
+.SH SEE ALSO
+.sp
+\fBllvm\-nm(1)\fP
+.SH AUTHOR
+Maintained by the LLVM Team (https://llvm.org/).
+.SH COPYRIGHT
+2003-2023, LLVM Project
+.\" Generated by docutils manpage writer.
+.