blob: 1d2fb59576974b775e42c1d0df9088b21502fffb [file] [log] [blame]
Douglas Katzman3459ce22015-10-08 04:24:12 +00001// RUN: %clang_cc1 -O1 -triple x86_64-none-linux-gnu -emit-llvm -debug-info-kind=line-tables-only %s -o - | FileCheck %s
David Majnemerdc012fa2015-04-22 21:38:15 +00002
3// Inserting lifetime markers should not affect debuginfo: lifetime.end is not
4// a destructor, but instrumentation for the compiler. Ensure the debug info for
5// the return statement (in the IR) does not point to the function closing '}'
6// which is used to show some destructors have been called before leaving the
7// function.
8
9extern int f(int);
10extern int g(int);
11
12// CHECK-LABEL: define i32 @test
13int test(int a, int b) {
14 int res;
15
16 if (a==2) {
17 int r = f(b);
18 res = r + b;
19 a += 2;
20 } else {
21 int r = f(a);
22 res = r + a;
23 b += 1;
24 }
25
26 return res;
27// CHECK: ret i32 %{{.*}}, !dbg [[DI:![0-9]+]]
Duncan P. N. Exon Smith9dd4e4e2015-04-29 16:40:08 +000028// CHECK: [[DI]] = !DILocation(line: [[@LINE-2]]
David Majnemerdc012fa2015-04-22 21:38:15 +000029}