Skip to content

Commit 1fd22c9

Browse files
committed
[llvm-debuginfo-analyzer] Add --output-sort=none option
1 parent 1c346e3 commit 1fd22c9

File tree

5 files changed

+23
-1
lines changed

5 files changed

+23
-1
lines changed

llvm/docs/CommandGuide/llvm-debuginfo-analyzer.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ output for a single compilation unit.
365365

366366
.. code-block:: text
367367
368+
=none: Unsorted output (i.e. as read from input).
368369
=id: Sort by unique element ID.
369370
=kind: Sort by element kind.
370371
=line: Sort by element line number.

llvm/test/tools/llvm-debuginfo-analyzer/COFF/01-coff-print-basic-details.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@
3232
; RUN: %p/Inputs/test-codeview-clang.o 2>&1 | \
3333
; RUN: FileCheck --strict-whitespace -check-prefix=ONE %s
3434

35+
; If `--output-sort=none`, `LVScope::Children` is not sorted; it, however,
36+
; reflects the order in which elements were added (same as `--output-sort=id`).
37+
; This is expected to change once #69160 is resolved though.
38+
; RUN: llvm-debuginfo-analyzer --attribute=level,format \
39+
; RUN: --output-sort=none \
40+
; RUN: --print=scopes,symbols,types,lines,instructions \
41+
; RUN: %p/Inputs/test-codeview-clang.o 2>&1 | \
42+
; RUN: FileCheck --strict-whitespace -check-prefix=ONE %s
43+
3544
; RUN: llvm-debuginfo-analyzer --attribute=level,format \
3645
; RUN: --output-sort=offset \
3746
; RUN: --print=elements \

llvm/test/tools/llvm-debuginfo-analyzer/DWARF/01-dwarf-print-basic-details.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@
3232
; RUN: %p/Inputs/test-dwarf-clang.o 2>&1 | \
3333
; RUN: FileCheck --strict-whitespace -check-prefix=ONE %s
3434

35+
; If `--output-sort=none`, `LVScope::Children` is not sorted; it, however,
36+
; reflects the order in which elements were added (same as `--output-sort=id`).
37+
; This is expected to change once #69160 is resolved though.
38+
; RUN: llvm-debuginfo-analyzer --attribute=level,format \
39+
; RUN: --output-sort=none \
40+
; RUN: --print=scopes,symbols,types,lines,instructions \
41+
; RUN: %p/Inputs/test-dwarf-clang.o 2>&1 | \
42+
; RUN: FileCheck --strict-whitespace -check-prefix=ONE %s
43+
3544
; RUN: llvm-debuginfo-analyzer --attribute=level,format \
3645
; RUN: --output-sort=offset \
3746
; RUN: --print=elements \

llvm/test/tools/llvm-debuginfo-analyzer/cmdline.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ HELP-ALL: --output-file=<filename> - Redirect output to the specified file.
110110
HELP-ALL: --output-folder=<pathname> - Folder name for view splitting.
111111
HELP-ALL: --output-level=<N> - Only print to a depth of N elements.
112112
HELP-ALL: --output-sort=<value> - Primary key when ordering logical view (default: line).
113+
HELP-ALL: =none - Unsorted output (i.e. as read from input).
113114
HELP-ALL: =id - Sort by unique element ID.
114115
HELP-ALL: =kind - Sort by element kind.
115116
HELP-ALL: =line - Sort by element line number.

llvm/tools/llvm-debuginfo-analyzer/Options.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,9 @@ static cl::opt<LVSortMode, true> OutputSort(
198198
"output-sort", cl::cat(OutputCategory),
199199
cl::desc("Primary key when ordering logical view (default: line)."),
200200
cl::Hidden, cl::ZeroOrMore,
201-
values(clEnumValN(LVSortMode::ID, "id", "Sort by unique element ID."),
201+
values(clEnumValN(LVSortMode::None, "none",
202+
"Unsorted output (i.e. as read from input)."),
203+
clEnumValN(LVSortMode::ID, "id", "Sort by unique element ID."),
202204
clEnumValN(LVSortMode::Kind, "kind", "Sort by element kind."),
203205
clEnumValN(LVSortMode::Line, "line", "Sort by element line number."),
204206
clEnumValN(LVSortMode::Name, "name", "Sort by element name."),

0 commit comments

Comments
 (0)