Home | History | Annotate | Download | only in CodeGen
      1 // RUN: %clang_cc1 -O1 -triple x86_64-none-linux-gnu -emit-llvm -debug-info-kind=line-tables-only %s -o - | FileCheck %s
      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]+]]
     28 // CHECK: [[DI]] = !DILocation(line: [[@LINE-2]]
     29 }
     30