[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGenCXX / linetable-cleanup.cpp
blob7e4ad9a37e78b3d378628e45c6e9ba5efa96ab7f
1 // RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -gno-column-info -triple x86_64-apple-darwin10 %s -o - | FileCheck %s
2 // RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -gno-column-info -triple x86_64-apple-darwin10 -std=c++98 %s -o - | FileCheck %s
3 // RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -gno-column-info -triple x86_64-apple-darwin10 -std=c++11 %s -o - | FileCheck %s
5 // Check the line numbers for cleanup code with EH in combination with
6 // simple return expressions.
8 // CHECK: define {{.*}}foo
9 // CHECK: call void @_ZN1CD1Ev(ptr {{.*}}){{( #[0-9])?}}, !dbg ![[RET:[0-9]+]]
10 // CHECK: ret i32 0, !dbg ![[RET]]
12 // CHECK: define {{.*}}bar
13 // CHECK: ret void, !dbg ![[RETBAR:[0-9]+]]
15 // CHECK: define {{.*}}baz
16 // CHECK: ret void, !dbg ![[RETBAZ:[0-9]+]]
18 class C {
19 public:
20 ~C() {}
21 int i;
24 int foo()
26 C c;
27 c.i = 42;
28 return 0;
29 // This breakpoint should be at/before the cleanup code.
30 // CHECK: ![[RET]] = !DILocation(line: [[@LINE+1]], scope: !{{.*}})
33 void bar()
35 if (!foo())
36 // CHECK: {{.*}} = !DILocation(line: [[@LINE+1]], scope: !{{.*}})
37 return;
39 if (foo()) {
40 C c;
41 c.i = foo();
43 // Clang creates only a single ret instruction. Make sure it is at a useful line.
44 // CHECK: ![[RETBAR]] = !DILocation(line: [[@LINE+1]], scope: !{{.*}})
47 void baz()
49 if (!foo())
50 // CHECK: ![[SCOPE1:.*]] = distinct !DILexicalBlock({{.*}}, line: [[@LINE-1]])
51 // CHECK: {{.*}} = !DILocation(line: [[@LINE+1]], scope: ![[SCOPE1]])
52 return;
54 if (foo()) {
55 // no cleanup
56 // CHECK: {{.*}} = !DILocation(line: [[@LINE+2]], scope: ![[SCOPE2:.*]])
57 // CHECK: ![[SCOPE2]] = distinct !DILexicalBlock({{.*}}, line: [[@LINE-3]])
58 return;
60 // CHECK: ![[RETBAZ]] = !DILocation(line: [[@LINE+1]], scope: !{{.*}})