Douglas Katzman | 3459ce2 | 2015-10-08 04:24:12 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -O1 -triple x86_64-none-linux-gnu -emit-llvm -debug-info-kind=line-tables-only %s -o - | FileCheck %s |
David Majnemer | dc012fa | 2015-04-22 21:38:15 +0000 | [diff] [blame] | 2 | |
| 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 | |
| 9 | extern int f(int); |
| 10 | extern int g(int); |
| 11 | |
| 12 | // CHECK-LABEL: define i32 @test |
| 13 | int 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 Smith | 9dd4e4e | 2015-04-29 16:40:08 +0000 | [diff] [blame] | 28 | // CHECK: [[DI]] = !DILocation(line: [[@LINE-2]] |
David Majnemer | dc012fa | 2015-04-22 21:38:15 +0000 | [diff] [blame] | 29 | } |