File: pr-57040-ignored-DW_FORM_implicit_const.test

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (67 lines) | stat: -rw-r--r-- 3,040 bytes parent folder | download | duplicates (5)
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
; REQUIRES: x86-registered-target

; Ignored attributes with DW_FORM_implicit_const.
; https://github.com/llvm/llvm-project/issues/57040

; Output generated by g++ (Debian 11.3.0-3) 11.3.0

; .debug_abbrev contents:
; [1] DW_TAG_formal_parameter     DW_CHILDREN_no
;         DW_AT_decl_file DW_FORM_implicit_const  1
;         DW_AT_decl_line DW_FORM_implicit_const  2

; [2] DW_TAG_typedef      DW_CHILDREN_no
;         DW_AT_decl_file DW_FORM_implicit_const  1
;         DW_AT_decl_line DW_FORM_data1

; Attributes with DW_FORM_implicit_const being ignored by the DWARFReader,
; causing {Parameter} and {TypeAlias} to omit line numbers.

; 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  }

; RUN: llvm-debuginfo-analyzer --attribute=level,format,producer \
; RUN:                         --print=scopes,symbols,types \
; RUN:                         %p/Inputs/pr-57040-test-dwarf-clang.o 2>&1 | \
; RUN: FileCheck --strict-whitespace -check-prefix=ONE %s

; ONE:      Logical View:
; ONE-NEXT: [000]           {File} 'pr-57040-test-dwarf-clang.o' -> elf64-x86-64
; ONE-EMPTY:
; ONE-NEXT: [001]             {CompileUnit} 'test.cpp'
; ONE-NEXT: [002]               {Producer} 'clang version 14.0.6'
; 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: [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'

; RUN: llvm-debuginfo-analyzer --attribute=level,format,producer \
; RUN:                         --print=scopes,symbols,types \
; RUN:                         %p/Inputs/pr-57040-test-dwarf-gcc.o 2>&1 | \
; RUN: FileCheck --strict-whitespace -check-prefix=TWO %s

; TWO:      Logical View:
; TWO-NEXT: [000]           {File} 'pr-57040-test-dwarf-gcc.o' -> elf64-x86-64
; TWO-EMPTY:
; TWO-NEXT: [001]             {CompileUnit} 'test.cpp'
; TWO-NEXT: [002]               {Producer} 'GNU C++17 11.3.0 {{.*}}'
; TWO-NEXT: [002]     1         {TypeAlias} 'INTPTR' -> '* const int'
; TWO-NEXT: [002]     2         {Function} extern not_inlined 'foo' -> 'int'
; TWO-NEXT: [003]                 {Block}
; TWO-NEXT: [004]     4             {TypeAlias} 'INTEGER' -> 'int'
; TWO-NEXT: [004]     5             {Variable} 'CONSTANT' -> 'const INTEGER'
; TWO-NEXT: [003]     2           {Parameter} 'ParamBool' -> 'bool'
; TWO-NEXT: [003]     2           {Parameter} 'ParamPtr' -> 'INTPTR'
; TWO-NEXT: [003]     2           {Parameter} 'ParamUnsigned' -> 'unsigned int'