xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/linetable-eh.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-macosx10.9.0 -munwind-tables -std=c++11 -fcxx-exceptions -fexceptions %s -o - | FileCheck %s
2*0a6a1f1dSLionel Sambuc 
3*0a6a1f1dSLionel Sambuc // Test that emitting a landing pad does not affect the line table
4*0a6a1f1dSLionel Sambuc // entries for the code that triggered it.
5*0a6a1f1dSLionel Sambuc 
6*0a6a1f1dSLionel Sambuc // CHECK: call void @llvm.dbg.declare
7*0a6a1f1dSLionel Sambuc // CHECK: call void @llvm.dbg.declare(metadata {{.*}}, metadata ![[CURRENT_ADDR:.*]], metadata !{{.*}}), !dbg ![[DBG1:.*]]
8*0a6a1f1dSLionel Sambuc // CHECK: unwind label %{{.*}}, !dbg ![[DBG1]]
9*0a6a1f1dSLionel Sambuc // CHECK: store i64 %{{.*}}, i64* %current_address, align 8, !dbg ![[DBG4:.*]]
10*0a6a1f1dSLionel Sambuc // CHECK-NEXT: call void @llvm.dbg.declare(metadata {{.*}}, metadata ![[FOUND_IT:.*]], metadata !{{.*}}), !dbg ![[DBG2:.*]]
11*0a6a1f1dSLionel Sambuc // CHECK: = landingpad
12*0a6a1f1dSLionel Sambuc // CHECK-NEXT: cleanup, !dbg ![[DBG3:.*]]
13*0a6a1f1dSLionel Sambuc // CHECK-DAG: ![[CURRENT_ADDR]] = {{.*}} [current_address]
14*0a6a1f1dSLionel Sambuc // CHECK-DAG: ![[FOUND_IT]] = {{.*}} [found_it]
15*0a6a1f1dSLionel Sambuc // CHECK-DAG: ![[DBG1]] = !MDLocation(line: 256,
16*0a6a1f1dSLionel Sambuc // CHECK-DAG: ![[DBG2]] = !MDLocation(line: 257,
17*0a6a1f1dSLionel Sambuc // CHECK-DAG: ![[DBG3]] = !MDLocation(line: 268,
18*0a6a1f1dSLionel Sambuc // CHECK-DAG: ![[DBG4]] = !MDLocation(line: 256,
19*0a6a1f1dSLionel Sambuc typedef unsigned long long uint64_t;
20*0a6a1f1dSLionel Sambuc template<class _Tp> class shared_ptr {
21*0a6a1f1dSLionel Sambuc public:
22*0a6a1f1dSLionel Sambuc   typedef _Tp element_type;
23*0a6a1f1dSLionel Sambuc   element_type* __ptr_;
24*0a6a1f1dSLionel Sambuc   ~shared_ptr();
operator ->() const25*0a6a1f1dSLionel Sambuc   element_type* operator->() const noexcept {return __ptr_;}
26*0a6a1f1dSLionel Sambuc };
27*0a6a1f1dSLionel Sambuc class Context {
28*0a6a1f1dSLionel Sambuc public:
29*0a6a1f1dSLionel Sambuc     uint64_t GetIt();
30*0a6a1f1dSLionel Sambuc };
31*0a6a1f1dSLionel Sambuc class Foo
32*0a6a1f1dSLionel Sambuc {
33*0a6a1f1dSLionel Sambuc     bool bar();
34*0a6a1f1dSLionel Sambuc     virtual shared_ptr<Context> GetContext () = 0;
35*0a6a1f1dSLionel Sambuc };
36*0a6a1f1dSLionel Sambuc # 253 "Foo.cpp" 3
37*0a6a1f1dSLionel Sambuc bool
bar()38*0a6a1f1dSLionel Sambuc Foo::bar ()
39*0a6a1f1dSLionel Sambuc {
40*0a6a1f1dSLionel Sambuc   uint64_t current_address = GetContext()->GetIt();
41*0a6a1f1dSLionel Sambuc   bool found_it = false;
42*0a6a1f1dSLionel Sambuc # 267 "Foo.cpp" 3
43*0a6a1f1dSLionel Sambuc   return found_it;
44*0a6a1f1dSLionel Sambuc }
45