[llvm] r351735 - [llvm-symbolizer] Add -no-demangle as alias for -demangle=false
Dmitry Venikov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 21 02:00:58 PST 2019
Author: quolyk
Date: Mon Jan 21 02:00:57 2019
New Revision: 351735
URL: http://llvm.org/viewvc/llvm-project?rev=351735&view=rev
Log:
[llvm-symbolizer] Add -no-demangle as alias for -demangle=false
Summary: Provides -no-demangle as alias for -demangle=false. Motivation: https://bugs.llvm.org/show_bug.cgi?id=40075
Reviewers: jhenderson, ruiu
Reviewed By: jhenderson
Subscribers: erik.pilkington, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D56773
Modified:
llvm/trunk/docs/CommandGuide/llvm-symbolizer.rst
llvm/trunk/test/DebugInfo/llvm-symbolizer.test
llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp
Modified: llvm/trunk/docs/CommandGuide/llvm-symbolizer.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/llvm-symbolizer.rst?rev=351735&r1=351734&r2=351735&view=diff
==============================================================================
--- llvm/trunk/docs/CommandGuide/llvm-symbolizer.rst (original)
+++ llvm/trunk/docs/CommandGuide/llvm-symbolizer.rst Mon Jan 21 02:00:57 2019
@@ -87,6 +87,10 @@ OPTIONS
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
Modified: llvm/trunk/test/DebugInfo/llvm-symbolizer.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/llvm-symbolizer.test?rev=351735&r1=351734&r2=351735&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/llvm-symbolizer.test (original)
+++ llvm/trunk/test/DebugInfo/llvm-symbolizer.test Mon Jan 21 02:00:57 2019
@@ -214,3 +214,16 @@ RUN: llvm-symbolizer --functions=short -
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()
Modified: llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp?rev=351735&r1=351734&r2=351735&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp (original)
+++ llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp Mon Jan 21 02:00:57 2019
@@ -54,12 +54,15 @@ static cl::opt<bool>
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 "
@@ -200,8 +203,12 @@ int main(int argc, char **argv) {
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);
More information about the llvm-commits
mailing list