1 ; REQUIRES: x86-registered-target
3 ; Test case 5 - Incorrect lexical scope variable.
6 ; 1 #include "definitions.h"
7 ; 2 forceinline int InlineFunction(int Param) {
10 ; 5 int Var_2 = Param + Var_1;
16 ; 11 int test(int Param_1, int Param_2) {
18 ; 13 A += InlineFunction(Param_2);
22 ; The above test is used to illustrate a variable issue found in the
24 ; PR43860: https://bugs.llvm.org/show_bug.cgi?id=43860
25 ; PR43205: https://github.com/llvm/llvm-project/issues/43205
27 ; In the following logical views, we can see that the CodeView debug
28 ; information generated by the Clang compiler shows the variables
29 ; 'Var_1' and 'Var_2' are at the same lexical scope (4) in the function
31 ; The CodeView generated by MSVC, show those variables at the correct
32 ; lexical scope: '3' and '4' respectively.
34 ; RUN: llvm-debuginfo-analyzer --attribute=level,format,producer \
35 ; RUN: --output-sort=name \
36 ; RUN: --print=symbols \
37 ; RUN: %p/Inputs/pr-43860-codeview-clang.o \
38 ; RUN: %p/Inputs/pr-43860-codeview-msvc.o 2>&1 | \
39 ; RUN: FileCheck --strict-whitespace -check-prefix=ONE %s
42 ; ONE-NEXT: [000] {File} 'pr-43860-codeview-clang.o' -> COFF-x86-64
44 ; ONE-NEXT: [001] {CompileUnit} 'pr-43860.cpp'
45 ; ONE-NEXT: [002] {Producer} 'clang version 15.0.0 {{.*}}'
46 ; ONE-NEXT: [002] 2 {Function} inlined 'InlineFunction' -> 'int'
47 ; ONE-NEXT: [003] {Parameter} '' -> 'int'
48 ; ONE-NEXT: [002] {Function} extern not_inlined 'test' -> 'int'
49 ; ONE-NEXT: [003] {Variable} 'A' -> 'int'
50 ; ONE-NEXT: [003] {InlinedFunction} inlined 'InlineFunction' -> 'int'
51 ; ONE-NEXT: [004] {Parameter} 'Param' -> 'int'
52 ; ONE-NEXT: [004] {Variable} 'Var_1' -> 'int'
53 ; ONE-NEXT: [004] {Variable} 'Var_2' -> 'int'
54 ; ONE-NEXT: [003] {Parameter} 'Param_1' -> 'int'
55 ; ONE-NEXT: [003] {Parameter} 'Param_2' -> 'int'
57 ; ONE-NEXT: Logical View:
58 ; ONE-NEXT: [000] {File} 'pr-43860-codeview-msvc.o' -> COFF-x86-64
60 ; ONE-NEXT: [001] {CompileUnit} 'pr-43860.cpp'
61 ; ONE-NEXT: [002] {Producer} 'Microsoft (R) Optimizing Compiler'
62 ; ONE-NEXT: [002] {Function} extern declared_inlined 'InlineFunction' -> 'int'
63 ; ONE-NEXT: [003] {Block}
64 ; ONE-NEXT: [004] {Variable} 'Var_2' -> 'int'
65 ; ONE-NEXT: [003] {Variable} 'Param' -> 'int'
66 ; ONE-NEXT: [003] {Variable} 'Var_1' -> 'int'
67 ; ONE-NEXT: [002] {Function} extern not_inlined 'test' -> 'int'
68 ; ONE-NEXT: [003] {Variable} 'A' -> 'int'
69 ; ONE-NEXT: [003] {Variable} 'Param_1' -> 'int'
70 ; ONE-NEXT: [003] {Variable} 'Param_2' -> 'int'
72 ; Using the selection facilities, we can produce a simple tabular output
73 ; showing just the logical elements that have in their name the 'var'
74 ; pattern. The logical view is sorted by the variables name.
76 ; RUN: llvm-debuginfo-analyzer --attribute=level,format \
77 ; RUN: --output-sort=name \
78 ; RUN: --select-regex --select-nocase \
80 ; RUN: --report=list \
81 ; RUN: --print=symbols \
82 ; RUN: %p/Inputs/pr-43860-*.o 2>&1 | \
83 ; RUN: FileCheck --strict-whitespace -check-prefix=TWO %s
86 ; TWO-NEXT: [000] {File} 'pr-43860-codeview-clang.o' -> COFF-x86-64
88 ; TWO-NEXT: [001] {CompileUnit} 'pr-43860.cpp'
89 ; TWO-NEXT: [004] {Variable} 'Var_1' -> 'int'
90 ; TWO-NEXT: [004] {Variable} 'Var_2' -> 'int'
92 ; TWO-NEXT: Logical View:
93 ; TWO-NEXT: [000] {File} 'pr-43860-codeview-msvc.o' -> COFF-x86-64
95 ; TWO-NEXT: [001] {CompileUnit} 'pr-43860.cpp'
96 ; TWO-NEXT: [003] {Variable} 'Var_1' -> 'int'
97 ; TWO-NEXT: [004] {Variable} 'Var_2' -> 'int'