1; REQUIRES: x86-registered-target
2
3; Ignored attributes with DW_FORM_implicit_const.
4; https://github.com/llvm/llvm-project/issues/57040
5
6; Output generated by g++ (Debian 11.3.0-3) 11.3.0
7
8; .debug_abbrev contents:
9; [1] DW_TAG_formal_parameter     DW_CHILDREN_no
10;         DW_AT_decl_file DW_FORM_implicit_const  1
11;         DW_AT_decl_line DW_FORM_implicit_const  2
12
13; [2] DW_TAG_typedef      DW_CHILDREN_no
14;         DW_AT_decl_file DW_FORM_implicit_const  1
15;         DW_AT_decl_line DW_FORM_data1
16
17; Attributes with DW_FORM_implicit_const being ignored by the DWARFReader,
18; causing {Parameter} and {TypeAlias} to omit line numbers.
19
20; test.cpp
21;  1  using INTPTR = const int *;
22;  2  int foo(INTPTR ParamPtr, unsigned ParamUnsigned, bool ParamBool) {
23;  3    if (ParamBool) {
24;  4      typedef int INTEGER;
25;  5      const INTEGER CONSTANT = 7;
26;  6      return CONSTANT;
27;  7    }
28;  8    return ParamUnsigned;
29;  9  }
30
31; RUN: llvm-debuginfo-analyzer --attribute=level,format,producer \
32; RUN:                         --print=scopes,symbols,types \
33; RUN:                         %p/Inputs/pr-57040-test-dwarf-clang.o 2>&1 | \
34; RUN: FileCheck --strict-whitespace -check-prefix=ONE %s
35
36; ONE:      Logical View:
37; ONE-NEXT: [000]           {File} 'pr-57040-test-dwarf-clang.o' -> elf64-x86-64
38; ONE-EMPTY:
39; ONE-NEXT: [001]             {CompileUnit} 'test.cpp'
40; ONE-NEXT: [002]               {Producer} 'clang version 14.0.6'
41; ONE-NEXT: [002]     1         {TypeAlias} 'INTPTR' -> '* const int'
42; ONE-NEXT: [002]     2         {Function} extern not_inlined 'foo' -> 'int'
43; ONE-NEXT: [003]                 {Block}
44; ONE-NEXT: [004]     5             {Variable} 'CONSTANT' -> 'const INTEGER'
45; ONE-NEXT: [003]     2           {Parameter} 'ParamBool' -> 'bool'
46; ONE-NEXT: [003]     2           {Parameter} 'ParamPtr' -> 'INTPTR'
47; ONE-NEXT: [003]     2           {Parameter} 'ParamUnsigned' -> 'unsigned int'
48; ONE-NEXT: [003]     4           {TypeAlias} 'INTEGER' -> 'int'
49
50; RUN: llvm-debuginfo-analyzer --attribute=level,format,producer \
51; RUN:                         --print=scopes,symbols,types \
52; RUN:                         %p/Inputs/pr-57040-test-dwarf-gcc.o 2>&1 | \
53; RUN: FileCheck --strict-whitespace -check-prefix=TWO %s
54
55; TWO:      Logical View:
56; TWO-NEXT: [000]           {File} 'pr-57040-test-dwarf-gcc.o' -> elf64-x86-64
57; TWO-EMPTY:
58; TWO-NEXT: [001]             {CompileUnit} 'test.cpp'
59; TWO-NEXT: [002]               {Producer} 'GNU C++17 11.3.0 {{.*}}'
60; TWO-NEXT: [002]     1         {TypeAlias} 'INTPTR' -> '* const int'
61; TWO-NEXT: [002]     2         {Function} extern not_inlined 'foo' -> 'int'
62; TWO-NEXT: [003]                 {Block}
63; TWO-NEXT: [004]     4             {TypeAlias} 'INTEGER' -> 'int'
64; TWO-NEXT: [004]     5             {Variable} 'CONSTANT' -> 'const INTEGER'
65; TWO-NEXT: [003]     2           {Parameter} 'ParamBool' -> 'bool'
66; TWO-NEXT: [003]     2           {Parameter} 'ParamPtr' -> 'INTPTR'
67; TWO-NEXT: [003]     2           {Parameter} 'ParamUnsigned' -> 'unsigned int'
68