[PATCH] D56773: [llvm-symbolizer] Add -no-demangle as alias for -demangle=false
Dmitry Venikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 20 23:28:01 PST 2019
Quolyk updated this revision to Diff 182747.
Quolyk added a comment.
Used clang-format -style='{ReflowComments: true}'.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56773/new/
https://reviews.llvm.org/D56773
Files:
docs/CommandGuide/llvm-symbolizer.rst
test/DebugInfo/llvm-symbolizer.test
tools/llvm-symbolizer/llvm-symbolizer.cpp
Index: tools/llvm-symbolizer/llvm-symbolizer.cpp
===================================================================
--- tools/llvm-symbolizer/llvm-symbolizer.cpp
+++ tools/llvm-symbolizer/llvm-symbolizer.cpp
@@ -55,12 +55,15 @@
ClPrintInlining("inlining", cl::init(true),
cl::desc("Print all inlined frames for a given address"));
-// -demangle, -C
+// -demangle, -C, -no-demangle
static cl::opt<bool>
ClDemangle("demangle", cl::init(true), cl::desc("Demangle function names"));
static cl::alias
ClDemangleShort("C", cl::desc("Alias for -demangle"),
cl::NotHidden, cl::aliasopt(ClDemangle));
+static cl::opt<bool>
+ClNoDemangle("no-demangle", cl::init(false),
+ cl::desc("Don't demangle function names"));
static cl::opt<std::string> ClDefaultArch("default-arch", cl::init(""),
cl::desc("Default architecture "
@@ -201,8 +204,12 @@
InitLLVM X(argc, argv);
llvm::sys::InitializeCOMRAII COM(llvm::sys::COMThreadingMode::MultiThreaded);
-
cl::ParseCommandLineOptions(argc, argv, "llvm-symbolizer\n");
+
+ // If both --demangle and --no-demangle are specified then pick the last one.
+ if (ClNoDemangle.getPosition() > ClDemangle.getPosition())
+ ClDemangle = !ClNoDemangle;
+
LLVMSymbolizer::Options Opts(ClPrintFunctions, ClUseSymbolTable, ClDemangle,
ClUseRelativeAddress, ClDefaultArch);
Index: test/DebugInfo/llvm-symbolizer.test
===================================================================
--- test/DebugInfo/llvm-symbolizer.test
+++ test/DebugInfo/llvm-symbolizer.test
@@ -214,3 +214,16 @@
RUN: | FileCheck %s --check-prefix=SHORT_FUNCTION_NAME
SHORT_FUNCTION_NAME-NOT: _Z1cv
+
+; Check that the last of --demangle and --no-demangle wins.
+RUN: llvm-symbolizer --demangle < %t.input7 \
+RUN: | FileCheck %s --check-prefix=DEMANGLED_FUNCTION_NAME
+RUN: llvm-symbolizer --no-demangle < %t.input7 \
+RUN: | FileCheck %s --check-prefix=MANGLED_FUNCTION_NAME
+RUN: llvm-symbolizer --demangle --no-demangle < %t.input7 \
+RUN: | FileCheck %s --check-prefix=MANGLED_FUNCTION_NAME
+RUN: llvm-symbolizer --no-demangle --demangle < %t.input7 \
+RUN: | FileCheck %s --check-prefix=DEMANGLED_FUNCTION_NAME
+
+MANGLED_FUNCTION_NAME: _Z1cv
+DEMANGLED_FUNCTION_NAME: c()
Index: docs/CommandGuide/llvm-symbolizer.rst
===================================================================
--- docs/CommandGuide/llvm-symbolizer.rst
+++ docs/CommandGuide/llvm-symbolizer.rst
@@ -87,6 +87,10 @@
Print demangled function names. Defaults to true.
+.. option:: -no-demangle
+
+ Don't print demangled function names.
+
.. option:: -inlining
If a source code location is in an inlined function, prints all the
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56773.182747.patch
Type: text/x-patch
Size: 2784 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190121/1161e487/attachment.bin>
More information about the llvm-commits
mailing list