Files
clang-p2996/clang/test/CodeGenCXX/linetable-cleanup.cpp
Adrian Prantl 52bf3c4c3f Reapply r180982 with repaired logic and an additional testcase.
Un-break the gdb buildbot.
- Use the debug location of the return expression for the cleanup code
  if the return expression is trivially evaluatable, regardless of the
  number of stop points in the function.
- Ensure that any EH code in the cleanup still gets the line number of
  the closing } of the lexical scope.
- Added a testcase with EH in the cleanup.

rdar://problem/13442648

llvm-svn: 181056
2013-05-03 20:11:48 +00:00

25 lines
646 B
C++

// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin10 %s -o - | FileCheck %s
// Check the line numbers for cleanup code with EH in combinatin with
// simple return expressions.
// CHECK: define {{.*}}foo
// CHECK: call void @_ZN1CD1Ev(%class.C* {{.*}}), !dbg ![[CLEANUP:[0-9]+]]
// CHECK: ret i32 0, !dbg ![[RET:[0-9]+]]
class C {
public:
~C() {}
int i;
};
int foo()
{
C c;
c.i = 42;
// This breakpoint should be at/before the cleanup code.
// CHECK: ![[CLEANUP]] = metadata !{i32 [[@LINE+1]], i32 0, metadata !{{.*}}, null}
return 0;
// CHECK: ![[RET]] = metadata !{i32 [[@LINE+1]], i32 0, metadata !{{.*}}, null}
}