Follow up to d0858bffa11, add missing REQUIRES x86
[llvm-project.git] / llvm / test / tools / llvm-debuginfo-analyzer / COFF / 05-coff-incorrect-lexical-scope-variable.test
blobdea30c9f2b37da62da8a732a68d2bea9aec888a5
1 ; REQUIRES: x86-registered-target
3 ; Test case 5 - Incorrect lexical scope variable.
5 ; pr-43860.cpp
6 ;  1  #include "definitions.h"
7 ;  2  forceinline int InlineFunction(int Param) {
8 ;  3    int Var_1 = Param;
9 ;  4    {
10 ;  5      int Var_2 = Param + Var_1;
11 ;  6      Var_1 = Var_2;
12 ;  7    }
13 ;  8    return Var_1;
14 ;  9  }
15 ; 10
16 ; 11  int test(int Param_1, int Param_2) {
17 ; 12    int A = Param_1;
18 ; 13    A += InlineFunction(Param_2);
19 ; 14    return A;
20 ; 15  }
22 ; The above test is used to illustrate a variable issue found in the
23 ; Clang compiler.
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
30 ; 'InlineFuction'.
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
41 ; ONE:      Logical View:
42 ; ONE-NEXT: [000]           {File} 'pr-43860-codeview-clang.o' -> COFF-x86-64
43 ; ONE-EMPTY:
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'
56 ; ONE-EMPTY:
57 ; ONE-NEXT: Logical View:
58 ; ONE-NEXT: [000]           {File} 'pr-43860-codeview-msvc.o' -> COFF-x86-64
59 ; ONE-EMPTY:
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 \
79 ; RUN:                         --select=Var \
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
85 ; TWO:      Logical View:
86 ; TWO-NEXT: [000]           {File} 'pr-43860-codeview-clang.o' -> COFF-x86-64
87 ; TWO-EMPTY:
88 ; TWO-NEXT: [001]           {CompileUnit} 'pr-43860.cpp'
89 ; TWO-NEXT: [004]           {Variable} 'Var_1' -> 'int'
90 ; TWO-NEXT: [004]           {Variable} 'Var_2' -> 'int'
91 ; TWO-EMPTY:
92 ; TWO-NEXT: Logical View:
93 ; TWO-NEXT: [000]           {File} 'pr-43860-codeview-msvc.o' -> COFF-x86-64
94 ; TWO-EMPTY:
95 ; TWO-NEXT: [001]           {CompileUnit} 'pr-43860.cpp'
96 ; TWO-NEXT: [003]           {Variable} 'Var_1' -> 'int'
97 ; TWO-NEXT: [004]           {Variable} 'Var_2' -> 'int'