aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/tools/llvm-debuginfo-analyzer/WebAssembly/01-wasm-compare-logical-elements.test
blob: f52c9c7cc7164195b4c98f9e873adf0a7baf8c3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
; REQUIRES: webassembly-registered-target

; Test case 1 - General options

; test.cpp
;  1  using INTPTR = const int *;
;  2  int foo(INTPTR ParamPtr, unsigned ParamUnsigned, bool ParamBool) {
;  3    if (ParamBool) {
;  4      typedef int INTEGER;
;  5      const INTEGER CONSTANT = 7;
;  6      return CONSTANT;
;  7    }
;  8    return ParamUnsigned;
;  9  }

; Compare mode - Logical view.
; The output shows in view form the 'missing (-), added (+)' elements,
; giving more context by swapping the reference and target object files.

; RUN: llvm-mc -arch=wasm32 -filetype=obj \
; RUN:         %p/Inputs/test-clang.s -o %t.test-clang.o

; RUN: llvm-debuginfo-analyzer --attribute=level \
; RUN:                         --compare=types \
; RUN:                         --report=view \
; RUN:                         --print=symbols,types \
; RUN:                         %t.test-clang.o \
; RUN:                         %p/../DWARF/Inputs/test-dwarf-gcc.o 2>&1 | \
; RUN: FileCheck --strict-whitespace -check-prefix=ONE %s

; ONE:      Reference: '{{.*}}test-clang.o'
; ONE-NEXT: Target:    'test-dwarf-gcc.o'
; ONE-EMPTY:
; ONE-NEXT: Logical View:
; ONE-NEXT:  [000]           {File} '{{.*}}test-clang.o'
; ONE-EMPTY:
; ONE-NEXT:  [001]             {CompileUnit} 'test.cpp'
; ONE-NEXT:  [002]     1         {TypeAlias} 'INTPTR' -> '* const int'
; ONE-NEXT:  [002]     2         {Function} extern not_inlined 'foo' -> 'int'
; ONE-NEXT:  [003]                 {Block}
; ONE-NEXT:  [004]     5             {Variable} 'CONSTANT' -> 'const INTEGER'
; ONE-NEXT: +[004]     4             {TypeAlias} 'INTEGER' -> 'int'
; ONE-NEXT:  [003]     2           {Parameter} 'ParamBool' -> 'bool'
; ONE-NEXT:  [003]     2           {Parameter} 'ParamPtr' -> 'INTPTR'
; ONE-NEXT:  [003]     2           {Parameter} 'ParamUnsigned' -> 'unsigned int'
; ONE-NEXT: -[003]     4           {TypeAlias} 'INTEGER' -> 'int'

; Compare mode - Logical elements.
; The output shows in tabular form the 'missing (-), added (+)' elements,
; giving more context by swapping the reference and target object files.

; RUN: llvm-debuginfo-analyzer --attribute=level \
; RUN:                         --compare=types \
; RUN:                         --report=list \
; RUN:                         --print=symbols,types,summary \
; RUN:                         %t.test-clang.o \
; RUN:                         %p/../DWARF/Inputs/test-dwarf-gcc.o 2>&1 | \
; RUN: FileCheck --strict-whitespace -check-prefix=TWO %s

; TWO:      Reference: '{{.*}}test-clang.o'
; TWO-NEXT: Target:    'test-dwarf-gcc.o'
; TWO-EMPTY:
; TWO-NEXT: (1) Missing Types:
; TWO-NEXT: -[003]     4     {TypeAlias} 'INTEGER' -> 'int'
; TWO-EMPTY:
; TWO-NEXT: (1) Added Types:
; TWO-NEXT: +[004]     4     {TypeAlias} 'INTEGER' -> 'int'
; TWO-EMPTY:
; TWO-NEXT: ----------------------------------------
; TWO-NEXT: Element   Expected    Missing      Added
; TWO-NEXT: ----------------------------------------
; TWO-NEXT: Scopes           4          0          0
; TWO-NEXT: Symbols          0          0          0
; TWO-NEXT: Types            2          1          1
; TWO-NEXT: Lines            0          0          0
; TWO-NEXT: ----------------------------------------
; TWO-NEXT: Total            6          1          1

; Changing the 'Reference' and 'Target' order:

; RUN: llvm-debuginfo-analyzer --attribute=level \
; RUN:                         --compare=types \
; RUN:                         --report=list \
; RUN:                         --print=symbols,types,summary \
; RUN:                         %p/../DWARF/Inputs/test-dwarf-gcc.o \
; RUN:                         %t.test-clang.o 2>&1 | \
; RUN: FileCheck --strict-whitespace -check-prefix=THR %s

; THR:      Reference: 'test-dwarf-gcc.o'
; THR-NEXT: Target:    '{{.*}}test-clang.o'
; THR-EMPTY:
; THR-NEXT: (1) Missing Types:
; THR-NEXT: -[004]     4     {TypeAlias} 'INTEGER' -> 'int'
; THR-EMPTY:
; THR-NEXT: (1) Added Types:
; THR-NEXT: +[003]     4     {TypeAlias} 'INTEGER' -> 'int'
; THR-EMPTY:
; THR-NEXT: ----------------------------------------
; THR-NEXT: Element   Expected    Missing      Added
; THR-NEXT: ----------------------------------------
; THR-NEXT: Scopes           4          0          0
; THR-NEXT: Symbols          0          0          0
; THR-NEXT: Types            2          1          1
; THR-NEXT: Lines            0          0          0
; THR-NEXT: ----------------------------------------
; THR-NEXT: Total            6          1          1