Clang Project

clang_source_code/test/CodeGen/debug-info-scope.c
1// RUN: %clang_cc1 -dwarf-version=4 -debug-info-kind=limited -disable-llvm-passes -emit-llvm < %s | FileCheck %s
2// RUN: %clang_cc1 -dwarf-version=4 -debug-info-kind=line-tables-only -disable-llvm-passes -emit-llvm < %s | FileCheck --check-prefix=GMLT %s
3// RUN: %clang_cc1 -dwarf-version=4 -debug-info-kind=line-directives-only -disable-llvm-passes -emit-llvm < %s | FileCheck --check-prefix=GMLT %s
4// Two variables with same name in separate scope.
5// Radar 8330217.
6int main() {
7 int j = 0;
8 int k = 0;
9// CHECK: !DILocalVariable(name: "i"
10// CHECK-NEXT: !DILexicalBlock(
11
12// Make sure we don't have any more lexical blocks because we don't need them in
13// -gmlt.
14// GMLT-NOT: !DILexicalBlock
15 for (int i = 0; i < 10; i++)
16 j++;
17// CHECK: !DILocalVariable(name: "i"
18// CHECK-NEXT: !DILexicalBlock(
19// GMLT-NOT: !DILexicalBlock
20 for (int i = 0; i < 10; i++)
21 k++;
22 return 0;
23}
24