1 ; REQUIRES: x86-registered-target
3 ; Test case 4 - Missing nested enumerations.
8 ; 3 enum NestedEnum { RED, BLUE };
18 ; The above test is used to illustrate a scope issue found in the Clang
20 ; PR46466: https://bugs.llvm.org/show_bug.cgi?id=46466
21 ; PR45811: https://github.com/llvm/llvm-project/issues/45811
23 ; In the following logical views, we can see that the DWARF debug
24 ; information generated by the Clang compiler does not include any
25 ; references to the enumerators 'RED' and 'BLUE'. The DWARF generated
26 ; by GCC, does include such references.
28 ; RUN: llvm-debuginfo-analyzer --attribute=level,format,producer \
29 ; RUN: --output-sort=name \
30 ; RUN: --print=symbols,types \
31 ; RUN: %p/Inputs/pr-46466-dwarf-clang.o \
32 ; RUN: %p/Inputs/pr-46466-dwarf-gcc.o 2>&1 | \
33 ; RUN: FileCheck --strict-whitespace -check-prefix=ONE %s
36 ; ONE-NEXT: [000] {File} 'pr-46466-dwarf-clang.o' -> elf64-x86-64
38 ; ONE-NEXT: [001] {CompileUnit} 'pr-46466.cpp'
39 ; ONE-NEXT: [002] {Producer} 'clang version 15.0.0 {{.*}}'
40 ; ONE-NEXT: [002] 8 {Variable} extern 'S' -> 'Struct'
41 ; ONE-NEXT: [002] 1 {Struct} 'Struct'
42 ; ONE-NEXT: [003] 5 {Member} public 'U' -> 'Union'
44 ; ONE-NEXT: Logical View:
45 ; ONE-NEXT: [000] {File} 'pr-46466-dwarf-gcc.o' -> elf64-x86-64
47 ; ONE-NEXT: [001] {CompileUnit} 'pr-46466.cpp'
48 ; ONE-NEXT: [002] {Producer} 'GNU C++14 10.3.0 {{.*}}'
49 ; ONE-NEXT: [002] 8 {Variable} extern 'S' -> 'Struct'
50 ; ONE-NEXT: [002] 1 {Struct} 'Struct'
51 ; ONE-NEXT: [003] 5 {Member} public 'U' -> 'Union'
52 ; ONE-NEXT: [003] 2 {Union} 'Union'
53 ; ONE-NEXT: [004] 3 {Enumeration} 'NestedEnum' -> 'unsigned int'
54 ; ONE-NEXT: [005] {Enumerator} 'BLUE' = '0x1'
55 ; ONE-NEXT: [005] {Enumerator} 'RED' = '0x0'
57 ; Using the selection facilities, we can produce a logical view
58 ; showing just the logical types that are 'Enumerator' and its
59 ; parents. The logical view is sorted by the types name.
61 ; RUN: llvm-debuginfo-analyzer --attribute=level,format \
62 ; RUN: --output-sort=name \
63 ; RUN: --select-types=Enumerator \
64 ; RUN: --report=parents \
65 ; RUN: --print=types \
66 ; RUN: %p/Inputs/pr-46466-*.o 2>&1 | \
67 ; RUN: FileCheck --strict-whitespace -check-prefix=TWO %s
70 ; TWO-NEXT: [000] {File} 'pr-46466-dwarf-clang.o' -> elf64-x86-64
72 ; TWO-NEXT: [001] {CompileUnit} 'pr-46466.cpp'
74 ; TWO-NEXT: Logical View:
75 ; TWO-NEXT: [000] {File} 'pr-46466-dwarf-gcc.o' -> elf64-x86-64
77 ; TWO-NEXT: [001] {CompileUnit} 'pr-46466.cpp'
78 ; TWO-NEXT: [002] 1 {Struct} 'Struct'
79 ; TWO-NEXT: [003] 2 {Union} 'Union'
80 ; TWO-NEXT: [004] 3 {Enumeration} 'NestedEnum' -> 'unsigned int'
81 ; TWO-NEXT: [005] {Enumerator} 'BLUE' = '0x1'
82 ; TWO-NEXT: [005] {Enumerator} 'RED' = '0x0'
84 ; Using the selection facilities, we can produce a simple tabular output
85 ; including a summary for the logical types that are 'Enumerator'. The
86 ; logical view is sorted by the types name.
88 ; RUN: llvm-debuginfo-analyzer --attribute=level,format \
89 ; RUN: --output-sort=name \
90 ; RUN: --select-types=Enumerator \
91 ; RUN: --print=types,summary \
92 ; RUN: %p/Inputs/pr-46466-*.o 2>&1 | \
93 ; RUN: FileCheck --strict-whitespace -check-prefix=THR %s
96 ; THR-NEXT: [000] {File} 'pr-46466-dwarf-clang.o' -> elf64-x86-64
98 ; THR-NEXT: [001] {CompileUnit} 'pr-46466.cpp'
100 ; THR-NEXT: -----------------------------
101 ; THR-NEXT: Element Total Printed
102 ; THR-NEXT: -----------------------------
103 ; THR-NEXT: Scopes 4 0
104 ; THR-NEXT: Symbols 0 0
105 ; THR-NEXT: Types 0 0
106 ; THR-NEXT: Lines 0 0
107 ; THR-NEXT: -----------------------------
108 ; THR-NEXT: Total 4 0
110 ; THR-NEXT: Logical View:
111 ; THR-NEXT: [000] {File} 'pr-46466-dwarf-gcc.o' -> elf64-x86-64
113 ; THR-NEXT: [001] {CompileUnit} 'pr-46466.cpp'
114 ; THR-NEXT: [005] {Enumerator} 'BLUE' = '0x1'
115 ; THR-NEXT: [005] {Enumerator} 'RED' = '0x0'
117 ; THR-NEXT: -----------------------------
118 ; THR-NEXT: Element Total Printed
119 ; THR-NEXT: -----------------------------
120 ; THR-NEXT: Scopes 5 0
121 ; THR-NEXT: Symbols 0 0
122 ; THR-NEXT: Types 2 2
123 ; THR-NEXT: Lines 0 0
124 ; THR-NEXT: -----------------------------
125 ; THR-NEXT: Total 7 2