1 // RUN: %clang_cc1 -std=c++11 -debug-info-kind=standalone -emit-llvm -triple x86_64-apple-darwin %s -o %t
2 // RUN: cat %t | FileCheck %s -check-prefix=CHECK0
3 // RUN: cat %t | FileCheck %s -check-prefix=CHECK1
4 // RUN: cat %t | FileCheck %s -check-prefix=CHECK2
6 // This test ensures that we associate a declaration with the
7 // definition of the constructor for OuterClass. The declaration is
8 // necessary so the backend can emit the DW_AT_specification attribute
14 static class InnerClass
{
16 InnerClass(); // Here createContextChain() generates a limited type for OuterClass.
18 // CHECK0: ![[DECL:[0-9]+]] = !DISubprogram(name: "OuterClass"
19 // CHECK0-SAME: line: [[@LINE+2]]
20 // CHECK0-SAME: spFlags: 0
21 OuterClass(const Foo
*); // line 10
23 OuterClass::InnerClass
OuterClass::theInnerClass
; // This toplevel decl causes InnerClass to be generated.
24 // CHECK0: !DISubprogram(name: "OuterClass"
25 // CHECK0-SAME: line: [[@LINE+3]]
26 // CHECK0-SAME: DISPFlagDefinition
27 // CHECK0-SAME: declaration: ![[DECL]]
28 OuterClass::OuterClass(const Foo
*meta
) { } // line 13
38 static class InnerClass1
{
42 // CHECK1: ![[DECL:[0-9]+]] = !DISubprogram(name: "Bar"
43 // CHECK1-SAME: line: [[@LINE+2]]
44 // CHECK1-SAME: spFlags: 0
45 void Bar(const Foo1
*);
47 OuterClass1::InnerClass1
OuterClass1::theInnerClass1
;
48 // CHECK1: !DISubprogram(name: "Bar"
49 // CHECK1-SAME: line: [[@LINE+3]]
50 // CHECK1-SAME: DISPFlagDefinition
51 // CHECK1-SAME: declaration: ![[DECL]]
52 void OuterClass1::Bar(const Foo1
*meta
) { }
61 static class InnerClass2
{
65 // CHECK2: ![[DECL:[0-9]+]] = !DISubprogram(name: "~OuterClass2"
66 // CHECK2-SAME: line: [[@LINE+2]]
67 // CHECK2-SAME: spFlags: 0
68 ~OuterClass2(); // line 10
70 OuterClass2::InnerClass2
OuterClass2::theInnerClass2
;
71 // CHECK4: !DISubprogram(name: "~OuterClass2"
72 // CHECK4-SAME: line: [[@LINE+3]]
73 // CHECK4-SAME: DISPFlagDefinition
74 // CHECK4-SAME: declaration: ![[DECL]]
75 OuterClass2::~OuterClass2() { }