brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 8ab96a7 Raw
46 lines · cpp
1// RUN: %clang_cc1 -debug-info-kind=limited -gno-column-info -triple=x86_64-pc-linux -emit-llvm %s -o - | FileCheck  %s2 3// The important thing is that the compare and the conditional branch have4// locs with the same scope (the lexical block for the 'if'). By turning off5// column info, they end up with the same !dbg record, which halves the number6// of checks to verify the scope.7 8int c = 2;9 10int f() {11#line 10012  if (int a = 5; a > c)13    return 1;14  return 0;15}16// CHECK-LABEL: define {{.*}} @_Z1fv()17// CHECK:       = icmp {{.*}} !dbg [[F_CMP:![0-9]+]]18// CHECK-NEXT:  br i1 {{.*}} !dbg [[F_CMP]]19 20int g() {21#line 20022  if (int a = f())23    return 2;24  return 3;25}26// CHECK-LABEL: define {{.*}} @_Z1gv()27// CHECK:       = icmp {{.*}} !dbg [[G_CMP:![0-9]+]]28// CHECK-NEXT:  br i1 {{.*}} !dbg [[G_CMP]]29 30int h() {31#line 30032  if (c > 3)33    return 4;34  return 5;35}36// CHECK-LABEL: define {{.*}} @_Z1hv()37// CHECK:       = icmp {{.*}} !dbg [[H_CMP:![0-9]+]]38// CHECK-NEXT:  br i1 {{.*}} !dbg [[H_CMP]]39 40// CHECK-DAG: [[F_CMP]] = !DILocation(line: 100, scope: [[F_SCOPE:![0-9]+]]41// CHECK-DAG: [[F_SCOPE]] = distinct !DILexicalBlock({{.*}} line: 100)42// CHECK-DAG: [[G_CMP]] = !DILocation(line: 200, scope: [[G_SCOPE:![0-9]+]]43// CHECK-DAG: [[G_SCOPE]] = distinct !DILexicalBlock({{.*}} line: 200)44// CHECK-DAG: [[H_CMP]] = !DILocation(line: 300, scope: [[H_SCOPE:![0-9]+]]45// CHECK-DAG: [[H_SCOPE]] = distinct !DILexicalBlock({{.*}} line: 300)46