Skip to content

Commit

Permalink
[llvm-symbolizer] Add -p as alias to -pretty-print
Browse files Browse the repository at this point in the history
Summary: Provides -p as a short alias for -pretty-print. Motivation: https://bugs.llvm.org/show_bug.cgi?id=40076

Reviewers: samsonov, khemant, ruiu, rnk, fjricci, jhenderson

Reviewed By: jhenderson

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D56542

llvm-svn: 350832
  • Loading branch information
Quolyk committed Jan 10, 2019
1 parent 6f302b8 commit 60d71e4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion llvm/docs/CommandGuide/llvm-symbolizer.rst
Expand Up @@ -110,7 +110,7 @@ OPTIONS

Print address before the source code location. Defaults to false.

.. option:: -pretty-print
.. option:: -pretty-print, -p

Print human readable output. If ``-inlining`` is specified, enclosing scope is
prefixed by (inlined by). Refer to listed examples.
Expand Down
5 changes: 3 additions & 2 deletions llvm/test/tools/llvm-symbolizer/sym.test
Expand Up @@ -18,9 +18,10 @@
#Build as : clang -g -O2 addr.c

RUN: llvm-symbolizer -print-address -obj=%p/Inputs/addr.exe < %p/Inputs/addr.inp | FileCheck %s
RUN: llvm-symbolizer -inlining -print-address -pretty-print -obj=%p/Inputs/addr.exe < %p/Inputs/addr.inp | FileCheck --check-prefix="PRETTY" %s
RUN: llvm-symbolizer -inlining -print-address -pretty-print -obj=%p/Inputs/addr.exe < %p/Inputs/addr.inp | FileCheck -check-prefix="PRETTY" %s
RUN: llvm-symbolizer -inlining -print-address -p -obj=%p/Inputs/addr.exe < %p/Inputs/addr.inp | FileCheck -check-prefix="PRETTY" %s
RUN: echo "0x1" > %t.input
RUN: llvm-symbolizer -obj=%p/Inputs/zero < %t.input | FileCheck --check-prefix="ZERO" %s
RUN: llvm-symbolizer -obj=%p/Inputs/zero < %t.input | FileCheck -check-prefix="ZERO" %s

#CHECK: some text
#CHECK: 0x40054d
Expand Down
4 changes: 4 additions & 0 deletions llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
Expand Up @@ -79,9 +79,13 @@ static cl::opt<bool>
ClPrintAddress("print-address", cl::init(false),
cl::desc("Show address before line information"));

// -pretty-print, -p
static cl::opt<bool>
ClPrettyPrint("pretty-print", cl::init(false),
cl::desc("Make the output more human friendly"));
static cl::alias ClPrettyPrintShort("p", cl::desc("Alias for -pretty-print"),
cl::NotHidden,
cl::aliasopt(ClPrettyPrint));

static cl::opt<int> ClPrintSourceContextLines(
"print-source-context-lines", cl::init(0),
Expand Down

0 comments on commit 60d71e4

Please sign in to comment.