133 lines · plain
1; REQUIRES: webassembly-registered-target2 3; Test case 4 - Missing nested enumerations.4 5; pr-46466.cpp6; 1 struct Struct {7; 2 union Union {8; 3 enum NestedEnum { RED, BLUE };9; 4 };10; 5 Union U;11; 6 };12; 713; 8 Struct S;14; 9 int test() {15; 10 return S.U.BLUE;16; 11 }17 18; The above test is used to illustrate a scope issue found in the Clang19; compiler.20; PR46466: https://bugs.llvm.org/show_bug.cgi?id=4646621; PR45811: https://github.com/llvm/llvm-project/issues/4581122 23; In the following logical views, we can see that the DWARF debug24; information generated by the Clang compiler does not include any25; references to the enumerators 'RED' and 'BLUE'. The DWARF generated26; by GCC, does include such references.27 28; RUN: llvm-mc -arch=wasm32 -filetype=obj \29; RUN: %p/Inputs/pr-46466-clang.s -o %t.pr-46466-clang.o30 31; RUN: llvm-debuginfo-analyzer --attribute=language,level,format,producer \32; RUN: --output-sort=name \33; RUN: --print=symbols,types \34; RUN: %t.pr-46466-clang.o \35; RUN: %p/../DWARF/Inputs/pr-46466-dwarf-gcc.o 2>&1 | \36; RUN: FileCheck --strict-whitespace -check-prefix=ONE %s37 38; ONE: Logical View:39; ONE-NEXT: [000] {File} '{{.*}}pr-46466-clang.o' -> WASM40; ONE-EMPTY:41; ONE-NEXT: [001] {CompileUnit} 'pr-46466.cpp'42; ONE-NEXT: [002] {Producer} 'clang version 19{{.*}}'43; ONE-NEXT: [002] {Language} 'DW_LANG_C_plus_plus_14'44; ONE-NEXT: [002] 8 {Variable} extern 'S' -> 'Struct'45; ONE-NEXT: [002] 1 {Struct} 'Struct'46; ONE-NEXT: [003] 5 {Member} public 'U' -> 'Union'47; ONE-EMPTY:48; ONE-NEXT: Logical View:49; ONE-NEXT: [000] {File} 'pr-46466-dwarf-gcc.o' -> elf64-x86-6450; ONE-EMPTY:51; ONE-NEXT: [001] {CompileUnit} 'pr-46466.cpp'52; ONE-NEXT: [002] {Producer} 'GNU C++14 10.3.0 {{.*}}'53; ONE-NEXT: [002] {Language} 'DW_LANG_C_plus_plus'54; ONE-NEXT: [002] 8 {Variable} extern 'S' -> 'Struct'55; ONE-NEXT: [002] 1 {Struct} 'Struct'56; ONE-NEXT: [003] 5 {Member} public 'U' -> 'Union'57; ONE-NEXT: [003] 2 {Union} 'Union'58; ONE-NEXT: [004] 3 {Enumeration} 'NestedEnum' -> 'unsigned int'59; ONE-NEXT: [005] {Enumerator} 'BLUE' = '0x1'60; ONE-NEXT: [005] {Enumerator} 'RED' = '0x0'61 62; Using the selection facilities, we can produce a logical view63; showing just the logical types that are 'Enumerator' and its64; parents. The logical view is sorted by the types name.65 66; RUN: llvm-debuginfo-analyzer --attribute=level,format \67; RUN: --output-sort=name \68; RUN: --select-types=Enumerator \69; RUN: --report=parents \70; RUN: --print=types \71; RUN: %t.pr-46466-clang.o \72; RUN: %p/../DWARF/Inputs/pr-46466-dwarf-gcc.o 2>&1 | \73; RUN: FileCheck --strict-whitespace -check-prefix=TWO %s74 75; TWO: Logical View:76; TWO-NEXT: [000] {File} '{{.*}}pr-46466-clang.o' -> WASM77; TWO-EMPTY:78; TWO-NEXT: [001] {CompileUnit} 'pr-46466.cpp'79; TWO-EMPTY:80; TWO-NEXT: Logical View:81; TWO-NEXT: [000] {File} 'pr-46466-dwarf-gcc.o' -> elf64-x86-6482; TWO-EMPTY:83; TWO-NEXT: [001] {CompileUnit} 'pr-46466.cpp'84; TWO-NEXT: [002] 1 {Struct} 'Struct'85; TWO-NEXT: [003] 2 {Union} 'Union'86; TWO-NEXT: [004] 3 {Enumeration} 'NestedEnum' -> 'unsigned int'87; TWO-NEXT: [005] {Enumerator} 'BLUE' = '0x1'88; TWO-NEXT: [005] {Enumerator} 'RED' = '0x0'89 90; Using the selection facilities, we can produce a simple tabular output91; including a summary for the logical types that are 'Enumerator'. The92; logical view is sorted by the types name.93 94; RUN: llvm-debuginfo-analyzer --attribute=level,format \95; RUN: --output-sort=name \96; RUN: --select-types=Enumerator \97; RUN: --print=types,summary \98; RUN: %t.pr-46466-clang.o \99; RUN: %p/../DWARF/Inputs/pr-46466-dwarf-gcc.o 2>&1 | \100; RUN: FileCheck --strict-whitespace -check-prefix=THR %s101 102; THR: Logical View:103; THR-NEXT: [000] {File} '{{.*}}pr-46466-clang.o' -> WASM104; THR-EMPTY:105; THR-NEXT: [001] {CompileUnit} 'pr-46466.cpp'106; THR-EMPTY:107; THR-NEXT: -----------------------------108; THR-NEXT: Element Total Printed109; THR-NEXT: -----------------------------110; THR-NEXT: Scopes 4 0111; THR-NEXT: Symbols 0 0112; THR-NEXT: Types 0 0113; THR-NEXT: Lines 0 0114; THR-NEXT: -----------------------------115; THR-NEXT: Total 4 0116; THR-EMPTY:117; THR-NEXT: Logical View:118; THR-NEXT: [000] {File} 'pr-46466-dwarf-gcc.o' -> elf64-x86-64119; THR-EMPTY:120; THR-NEXT: [001] {CompileUnit} 'pr-46466.cpp'121; THR-NEXT: [005] {Enumerator} 'BLUE' = '0x1'122; THR-NEXT: [005] {Enumerator} 'RED' = '0x0'123; THR-EMPTY:124; THR-NEXT: -----------------------------125; THR-NEXT: Element Total Printed126; THR-NEXT: -----------------------------127; THR-NEXT: Scopes 5 0128; THR-NEXT: Symbols 0 0129; THR-NEXT: Types 2 2130; THR-NEXT: Lines 0 0131; THR-NEXT: -----------------------------132; THR-NEXT: Total 7 2133