1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[llvm-dwarfdump] --statistics: break lines and indent by 2

so that the user does not have to pipe the output to `jq` or `python -m json.tool`.
This change makes testing more convenient because `-NEXT` patterns can be used.
The "prettify by default" is a good tradeoff to make. The output size increases a bit.

Differential Revision: https://reviews.llvm.org/D86318
This commit is contained in:
Fangrui Song 2020-08-21 09:32:20 -07:00
parent 3e888e3981
commit ed1bc644de
12 changed files with 173 additions and 167 deletions

View File

@ -1,88 +1,94 @@
; RUN: llc -debug-entry-values %s -o - -filetype=obj \
; RUN: | llvm-dwarfdump -statistics - | FileCheck %s
; CHECK: "sum_all_variables(#bytes in parent scope covered by DW_OP_entry_value)":5
; CHECK: "sum_all_params(#bytes in parent scope)":20
; CHECK: "sum_all_params(#bytes in parent scope covered by DW_AT_location)":20
; CHECK: "sum_all_params(#bytes in parent scope covered by DW_OP_entry_value)":5
; CHECK: "sum_all_local_vars(#bytes in parent scope)":90
; CHECK: "sum_all_local_vars(#bytes in parent scope covered by DW_AT_location)":60
; CHECK: "sum_all_local_vars(#bytes in parent scope covered by DW_OP_entry_value)":0
; CHECK: "#variables processed by location statistics":6
; CHECK: "#variables with 0% of parent scope covered by DW_AT_location":1
; CHECK: "#variables with (0%,10%) of parent scope covered by DW_AT_location":0
; CHECK: "#variables with [10%,20%) of parent scope covered by DW_AT_location":0
; CHECK: "#variables with [20%,30%) of parent scope covered by DW_AT_location":0
; CHECK: "#variables with [30%,40%) of parent scope covered by DW_AT_location":0
; CHECK: "#variables with [40%,50%) of parent scope covered by DW_AT_location":0
; CHECK: "#variables with [50%,60%) of parent scope covered by DW_AT_location":1
; CHECK: "#variables with [60%,70%) of parent scope covered by DW_AT_location":0
; CHECK: "#variables with [70%,80%) of parent scope covered by DW_AT_location":0
; CHECK: "#variables with [80%,90%) of parent scope covered by DW_AT_location":1
; CHECK: "#variables with [90%,100%) of parent scope covered by DW_AT_location":0
; CHECK: "#variables with 100% of parent scope covered by DW_AT_location":3
; CHECK: "#variables - entry values with 0% of parent scope covered by DW_AT_location":1
; CHECK: "#variables - entry values with (0%,10%) of parent scope covered by DW_AT_location":0
; CHECK: "#variables - entry values with [10%,20%) of parent scope covered by DW_AT_location":0
; CHECK: "#variables - entry values with [20%,30%) of parent scope covered by DW_AT_location":0
; CHECK: "#variables - entry values with [30%,40%) of parent scope covered by DW_AT_location":0
; CHECK: "#variables - entry values with [40%,50%) of parent scope covered by DW_AT_location":0
; CHECK: "#variables - entry values with [50%,60%) of parent scope covered by DW_AT_location":2
; CHECK: "#variables - entry values with [60%,70%) of parent scope covered by DW_AT_location":0
; CHECK: "#variables - entry values with [70%,80%) of parent scope covered by DW_AT_location":0
; CHECK: "#variables - entry values with [80%,90%) of parent scope covered by DW_AT_location":1
; CHECK: "#variables - entry values with [90%,100%) of parent scope covered by DW_AT_location":0
; CHECK: "#variables - entry values with 100% of parent scope covered by DW_AT_location":2
; CHECK: "#params processed by location statistics":2
; CHECK: "#params with 0% of parent scope covered by DW_AT_location":0
; CHECK: "#params with (0%,10%) of parent scope covered by DW_AT_location":0
; CHECK: "#params with [10%,20%) of parent scope covered by DW_AT_location":0
; CHECK: "#params with [20%,30%) of parent scope covered by DW_AT_location":0
; CHECK: "#params with [30%,40%) of parent scope covered by DW_AT_location":0
; CHECK: "#params with [40%,50%) of parent scope covered by DW_AT_location":0
; CHECK: "#params with [50%,60%) of parent scope covered by DW_AT_location":0
; CHECK: "#params with [60%,70%) of parent scope covered by DW_AT_location":0
; CHECK: "#params with [70%,80%) of parent scope covered by DW_AT_location":0
; CHECK: "#params with [80%,90%) of parent scope covered by DW_AT_location":0
; CHECK: "#params with [90%,100%) of parent scope covered by DW_AT_location":0
; CHECK: "#params with 100% of parent scope covered by DW_AT_location":2
; CHECK: "#params - entry values with 0% of parent scope covered by DW_AT_location":0
; CHECK: "#params - entry values with (0%,10%) of parent scope covered by DW_AT_location":0
; CHECK: "#params - entry values with [10%,20%) of parent scope covered by DW_AT_location":0
; CHECK: "#params - entry values with [20%,30%) of parent scope covered by DW_AT_location":0
; CHECK: "#params - entry values with [30%,40%) of parent scope covered by DW_AT_location":0
; CHECK: "#params - entry values with [40%,50%) of parent scope covered by DW_AT_location":0
; CHECK: "#params - entry values with [50%,60%) of parent scope covered by DW_AT_location":1
; CHECK: "#params - entry values with [60%,70%) of parent scope covered by DW_AT_location":0
; CHECK: "#params - entry values with [70%,80%) of parent scope covered by DW_AT_location":0
; CHECK: "#params - entry values with [80%,90%) of parent scope covered by DW_AT_location":0
; CHECK: "#params - entry values with [90%,100%) of parent scope covered by DW_AT_location":0
; CHECK: "#params - entry values with 100% of parent scope covered by DW_AT_location":1
; CHECK: "#local vars processed by location statistics":4
; CHECK: "#local vars with 0% of parent scope covered by DW_AT_location":1
; CHECK: "#local vars with (0%,10%) of parent scope covered by DW_AT_location":0
; CHECK: "#local vars with [10%,20%) of parent scope covered by DW_AT_location":0
; CHECK: "#local vars with [20%,30%) of parent scope covered by DW_AT_location":0
; CHECK: "#local vars with [30%,40%) of parent scope covered by DW_AT_location":0
; CHECK: "#local vars with [40%,50%) of parent scope covered by DW_AT_location":0
; CHECK: "#local vars with [50%,60%) of parent scope covered by DW_AT_location":1
; CHECK: "#local vars with [60%,70%) of parent scope covered by DW_AT_location":0
; CHECK: "#local vars with [70%,80%) of parent scope covered by DW_AT_location":0
; CHECK: "#local vars with [80%,90%) of parent scope covered by DW_AT_location":1
; CHECK: "#local vars with [90%,100%) of parent scope covered by DW_AT_location":0
; CHECK: "#local vars with 100% of parent scope covered by DW_AT_location":1
; CHECK: "#local vars - entry values with 0% of parent scope covered by DW_AT_location":1
; CHECK: "#local vars - entry values with (0%,10%) of parent scope covered by DW_AT_location":0
; CHECK: "#local vars - entry values with [10%,20%) of parent scope covered by DW_AT_location":0
; CHECK: "#local vars - entry values with [20%,30%) of parent scope covered by DW_AT_location":0
; CHECK: "#local vars - entry values with [30%,40%) of parent scope covered by DW_AT_location":0
; CHECK: "#local vars - entry values with [40%,50%) of parent scope covered by DW_AT_location":0
; CHECK: "#local vars - entry values with [50%,60%) of parent scope covered by DW_AT_location":1
; CHECK: "#local vars - entry values with [60%,70%) of parent scope covered by DW_AT_location":0
; CHECK: "#local vars - entry values with [70%,80%) of parent scope covered by DW_AT_location":0
; CHECK: "#local vars - entry values with [80%,90%) of parent scope covered by DW_AT_location":1
; CHECK: "#local vars - entry values with [90%,100%) of parent scope covered by DW_AT_location":0
; CHECK: "#local vars - entry values with 100% of parent scope covered by DW_AT_location":1
; CHECK: "sum_all_variables(#bytes in parent scope covered by DW_OP_entry_value)": 5,
; CHECK-NEXT: "sum_all_params(#bytes in parent scope)": 20,
; CHECK-NEXT: "sum_all_params(#bytes in parent scope covered by DW_AT_location)": 20,
; CHECK-NEXT: "sum_all_params(#bytes in parent scope covered by DW_OP_entry_value)": 5,
; CHECK-NEXT: "sum_all_local_vars(#bytes in parent scope)": 90,
; CHECK-NEXT: "sum_all_local_vars(#bytes in parent scope covered by DW_AT_location)": 60,
; CHECK-NEXT: "sum_all_local_vars(#bytes in parent scope covered by DW_OP_entry_value)": 0,
; CHECK-NEXT: "#bytes within functions": 45,
; CHECK-NEXT: "#bytes within inlined functions": 0,
; CHECK-NEXT: "#params": 2,
; CHECK-NEXT: "#params with source location": 2,
; CHECK-NEXT: "#params with type": 2,
; CHECK-NEXT: "#params with binary location": 2,
; CHECK: "#variables processed by location statistics": 6,
; CHECK-NEXT: "#variables with 0% of parent scope covered by DW_AT_location": 1,
; CHECK-NEXT: "#variables with (0%,10%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#variables with [10%,20%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#variables with [20%,30%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#variables with [30%,40%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#variables with [40%,50%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#variables with [50%,60%) of parent scope covered by DW_AT_location": 1,
; CHECK-NEXT: "#variables with [60%,70%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#variables with [70%,80%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#variables with [80%,90%) of parent scope covered by DW_AT_location": 1,
; CHECK-NEXT: "#variables with [90%,100%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#variables with 100% of parent scope covered by DW_AT_location": 3,
; CHECK-NEXT: "#variables - entry values with 0% of parent scope covered by DW_AT_location": 1,
; CHECK-NEXT: "#variables - entry values with (0%,10%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#variables - entry values with [10%,20%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#variables - entry values with [20%,30%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#variables - entry values with [30%,40%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#variables - entry values with [40%,50%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#variables - entry values with [50%,60%) of parent scope covered by DW_AT_location": 2,
; CHECK-NEXT: "#variables - entry values with [60%,70%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#variables - entry values with [70%,80%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#variables - entry values with [80%,90%) of parent scope covered by DW_AT_location": 1,
; CHECK-NEXT: "#variables - entry values with [90%,100%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#variables - entry values with 100% of parent scope covered by DW_AT_location": 2,
; CHECK-NEXT: "#params processed by location statistics": 2,
; CHECK-NEXT: "#params with 0% of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#params with (0%,10%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#params with [10%,20%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#params with [20%,30%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#params with [30%,40%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#params with [40%,50%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#params with [50%,60%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#params with [60%,70%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#params with [70%,80%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#params with [80%,90%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#params with [90%,100%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#params with 100% of parent scope covered by DW_AT_location": 2,
; CHECK-NEXT: "#params - entry values with 0% of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#params - entry values with (0%,10%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#params - entry values with [10%,20%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#params - entry values with [20%,30%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#params - entry values with [30%,40%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#params - entry values with [40%,50%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#params - entry values with [50%,60%) of parent scope covered by DW_AT_location": 1,
; CHECK-NEXT: "#params - entry values with [60%,70%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#params - entry values with [70%,80%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#params - entry values with [80%,90%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#params - entry values with [90%,100%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#params - entry values with 100% of parent scope covered by DW_AT_location": 1,
; CHECK-NEXT: "#local vars processed by location statistics": 4,
; CHECK-NEXT: "#local vars with 0% of parent scope covered by DW_AT_location": 1,
; CHECK-NEXT: "#local vars with (0%,10%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#local vars with [10%,20%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#local vars with [20%,30%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#local vars with [30%,40%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#local vars with [40%,50%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#local vars with [50%,60%) of parent scope covered by DW_AT_location": 1,
; CHECK-NEXT: "#local vars with [60%,70%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#local vars with [70%,80%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#local vars with [80%,90%) of parent scope covered by DW_AT_location": 1,
; CHECK-NEXT: "#local vars with [90%,100%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#local vars with 100% of parent scope covered by DW_AT_location": 1,
; CHECK-NEXT: "#local vars - entry values with 0% of parent scope covered by DW_AT_location": 1,
; CHECK-NEXT: "#local vars - entry values with (0%,10%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#local vars - entry values with [10%,20%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#local vars - entry values with [20%,30%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#local vars - entry values with [30%,40%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#local vars - entry values with [40%,50%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#local vars - entry values with [50%,60%) of parent scope covered by DW_AT_location": 1,
; CHECK-NEXT: "#local vars - entry values with [60%,70%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#local vars - entry values with [70%,80%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#local vars - entry values with [80%,90%) of parent scope covered by DW_AT_location": 1,
; CHECK-NEXT: "#local vars - entry values with [90%,100%) of parent scope covered by DW_AT_location": 0,
; CHECK-NEXT: "#local vars - entry values with 100% of parent scope covered by DW_AT_location": 1
; The source code of the test case:
; extern void fn3(int *);

View File

@ -5,8 +5,8 @@
# RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj -o %t
# RUN: llvm-dwarfdump --statistics %t | FileCheck %s
# CHECK: "sum_all_local_vars(#bytes in parent scope)":12
# CHECK: "sum_all_local_vars(#bytes in parent scope covered by DW_AT_location)":8
# CHECK: "sum_all_local_vars(#bytes in parent scope)": 12,
# CHECK: "sum_all_local_vars(#bytes in parent scope covered by DW_AT_location)": 8,
.text

View File

@ -69,28 +69,28 @@ RUN: llvm-dwarfdump --statistics statistics-fib.split-dwarf.o | FileCheck %s
# }
#
CHECK: "version":5
CHECK: "#functions":3
CHECK: "#functions with location":3
CHECK: "#inlined functions":7
CHECK: "#inlined functions with abstract origins":7
CHECK: "#unique source variables":9
CHECK: "#source variables":30
CHECK: "version": 5,
CHECK: "#functions": 3,
CHECK: "#functions with location": 3,
CHECK: "#inlined functions": 7,
CHECK: "#inlined functions with abstract origins": 7,
CHECK: "#unique source variables": 9,
CHECK: "#source variables": 30,
# Ideally the value below would be 33 but currently it's not.
CHECK: "#source variables with location":22
CHECK: "#call site entries":7
CHECK: "sum_all_variables(#bytes in parent scope)":2817
CHECK: "sum_all_variables(#bytes in parent scope covered by DW_AT_location)":1160
CHECK: "#bytes within functions":594
CHECK: "#bytes within inlined functions":345
CHECK: "#params":12
CHECK: "#params with source location":12
CHECK: "#params with type":12
CHECK: "#params with binary location":12
CHECK: "#local vars":18
CHECK: "#local vars with source location":18
CHECK: "#local vars with type":18
CHECK: "#source variables with location": 22,
CHECK: "#call site entries": 7,
CHECK: "sum_all_variables(#bytes in parent scope)": 2817,
CHECK: "sum_all_variables(#bytes in parent scope covered by DW_AT_location)": 1160,
CHECK: "#bytes within functions": 594,
CHECK: "#bytes within inlined functions": 345,
CHECK: "#params": 12,
CHECK-NEXT: "#params with source location": 12,
CHECK-NEXT: "#params with type": 12,
CHECK-NEXT: "#params with binary location": 12,
CHECK-NEXT: "#local vars": 18,
CHECK-NEXT: "#local vars with source location": 18,
CHECK-NEXT: "#local vars with type": 18,
# Ideally the value below would be 18, but currently it's not.
CHECK: "#local vars with binary location":10
CHECK: "#local vars with binary location": 10,

View File

@ -64,28 +64,28 @@ RUN: llvm-dwarfdump --statistics %t-statistics-fib.o | FileCheck %s
# }
#
CHECK: "version":5
CHECK: "#functions":3
CHECK: "#functions with location":3
CHECK: "#inlined functions":8
CHECK: "#inlined functions with abstract origins":8
CHECK: "#unique source variables":9
CHECK: "#source variables":33
CHECK: "version": 5,
CHECK: "#functions": 3,
CHECK: "#functions with location": 3,
CHECK: "#inlined functions": 8,
CHECK: "#inlined functions with abstract origins": 8,
CHECK: "#unique source variables": 9,
CHECK: "#source variables": 33,
# Ideally the value below would be 33 but currently it's not.
CHECK: "#source variables with location":24
CHECK: "#call site entries":8
CHECK: "sum_all_variables(#bytes in parent scope)":3072
CHECK: "sum_all_variables(#bytes in parent scope covered by DW_AT_location)":1188
CHECK: "#bytes within functions":636
CHECK: "#bytes within inlined functions":388
CHECK: "#params":13
CHECK: "#params with source location":13
CHECK: "#params with type":13
CHECK: "#params with binary location":13
CHECK: "#local vars":20
CHECK: "#local vars with source location":20
CHECK: "#local vars with type":20
CHECK: "#source variables with location": 24,
CHECK: "#call site entries": 8,
CHECK: "sum_all_variables(#bytes in parent scope)": 3072,
CHECK: "sum_all_variables(#bytes in parent scope covered by DW_AT_location)": 1188,
CHECK: "#bytes within functions": 636,
CHECK: "#bytes within inlined functions": 388,
CHECK: "#params": 13,
CHECK-NEXT: "#params with source location": 13,
CHECK-NEXT: "#params with type": 13,
CHECK-NEXT: "#params with binary location": 13,
CHECK-NEXT: "#local vars": 20,
CHECK-NEXT: "#local vars with source location": 20,
CHECK-NEXT: "#local vars with type": 20,
# Ideally the value below would be 20, but currently it's not.
CHECK: "#local vars with binary location":11
CHECK-NEXT: "#local vars with binary location": 11,

View File

@ -1,6 +1,6 @@
; RUN: llc -O0 %s -o - -filetype=obj \
; RUN: | llvm-dwarfdump -statistics - | FileCheck %s
; CHECK: "version":5
; CHECK: "version": 5,
; namespace test {
; extern int a;
@ -41,24 +41,24 @@
; - non-constant member S:fn,
; - arguments of S:fn.
; CHECK: "#unique source variables":10
; CHECK: "#unique source variables": 10,
; +1 extra inline i.
; CHECK: "#source variables":11
; CHECK: "#source variables": 11,
; -1 square::i
; CHECK: "#source variables with location":10
; CHECK: "#source variables with location": 10,
; CHECK: "sum_all_local_vars(#bytes in parent scope)": [[BYTES:[0-9]+]]
; Because of the dbg.value in the middle of the function, the pc range coverage
; must be below 100%.
; CHECK-NOT: "sum_all_local_vars(#bytes in parent scope covered by DW_AT_location)":0
; CHECK-NOT: "sum_all_local_vars(#bytes in parent scope covered by DW_AT_location)": 0,
; CHECK-NOT: "sum_all_local_vars(#bytes in parent scope covered by DW_AT_location)": [[BYTES]]
; CHECK: "sum_all_local_vars(#bytes in parent scope covered by DW_AT_location)":
; CHECK: "#bytes within functions": [[FUNCSIZE:[0-9]+]]
; CHECK: "#bytes within inlined functions": [[INLINESIZE:[0-9]+]]
; CHECK: "#bytes in __debug_info":459
; CHECK: "#bytes in __debug_loc":35
; CHECK: "#bytes in __debug_abbrev":384
; CHECK: "#bytes in __debug_line":126
; CHECK: "#bytes in __debug_str":231
; CHECK: "#bytes in __debug_info": 459,
; CHECK-NEXT: "#bytes in __debug_loc": 35,
; CHECK-NEXT: "#bytes in __debug_abbrev": 384,
; CHECK-NEXT: "#bytes in __debug_line": 126,
; CHECK-NEXT: "#bytes in __debug_str": 231,
; ModuleID = '/tmp/quality.cpp'
source_filename = "/tmp/quality.cpp"

View File

@ -12,8 +12,8 @@
; foo(&local1, arg2, 10, 15, arg3 + 3, arg1 + arg2);
; }
;
; CHECK: "#call site DIEs":2
; CHECK-SAME: "#call site parameter DIEs":6
; CHECK: "#call site DIEs": 2,
; CHECK-NEXT: "#call site parameter DIEs": 6,
;
; ModuleID = 'test.c'
source_filename = "test.c"

View File

@ -4,10 +4,10 @@
; Test that abstract origins in multiple CUs are uniqued.
; CHECK: "#functions": 4,
; CHECK-SAME: "#inlined functions":2,
; CHECK-SAME: "#unique source variables":4
; CHECK-SAME: "#source variables":6
; CHECK-SAME: "#source variables with location":6
; CHECK: "#inlined functions": 2,
; CHECK: "#unique source variables": 4,
; CHECK-NEXT: "#source variables": 6,
; CHECK-NEXT: "#source variables with location": 6,
;header.h:
;extern "C" int getchar();

View File

@ -5,10 +5,10 @@
; The results for both tests should be identical.
; CHECK: "#functions": 4,
; CHECK-SAME: "#inlined functions":2,
; CHECK-SAME: "#unique source variables":4
; CHECK-SAME: "#source variables":6
; CHECK-SAME: "#source variables with location":6
; CHECK: "#inlined functions": 2,
; CHECK: "#unique source variables": 4,
; CHECK-NEXT: "#source variables": 6,
; CHECK-NEXT: "#source variables with location": 6,
;header.h:
;extern "C" int getchar();

View File

@ -18,12 +18,13 @@
; #include "test.h"
; int far() { return foo(42); }
; CHECK: "#functions":3
; CHECK-SAME: "#functions with location":3
; CHECK-SAME: "#inlined functions":0
; CHECK-SAME: "#unique source variables":1
; CHECK-SAME: "#source variables":2
; CHECK-SAME: "#source variables with location":2
; CHECK: "#functions": 3,
; CHECK-NEXT: "#functions with location": 3,
; CHECK-NEXT: "#inlined functions": 0,
; CHECK-NEXT: "#inlined functions with abstract origins": 0,
; CHECK-NEXT: "#unique source variables": 1,
; CHECK-NEXT: "#source variables": 2,
; CHECK-NEXT: "#source variables with location": 2,
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

View File

@ -16,8 +16,8 @@
; #include "test.h"
; s S2;
; CHECK: "#source variables":4
; CHECK-SAME: "#source variables with location":4
; CHECK: "#source variables": 4,
; CHECK: "#source variables with location": 4,
source_filename = "llvm-link"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"

View File

@ -4,8 +4,8 @@
; Test that statistics distinguish functions with the same name.
; CHECK: "#functions": 4,
; CHECK-SAME: "#unique source variables":2
; CHECK-SAME: "#source variables":2
; CHECK: "#unique source variables": 2,
; CHECK-NEXT: "#source variables": 2,
; $ cat test1.cpp
; static int foo(int a) {

View File

@ -466,8 +466,7 @@ static void collectStatsRecursive(DWARFDie Die, std::string FnPrefix,
}
}
/// Print machine-readable output.
/// The machine-readable format is single-line JSON output.
/// Print human-readable output.
/// \{
static void printDatum(json::OStream &J, const char *Key, json::Value Value) {
J.attribute(Key, Value);
@ -593,7 +592,7 @@ bool dwarfdump::collectStatsForObjectFile(ObjectFile &Obj, DWARFContext &DICtx,
// Print summary.
OS.SetBufferSize(1024);
json::OStream J(OS);
json::OStream J(OS, 2);
J.objectBegin();
J.attribute("version", Version);
LLVM_DEBUG(llvm::dbgs() << "Variable location quality metrics\n";