1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -std=c++11 -g -emit-llvm -g -triple x86_64-apple-darwin %s -o %t 2f4a2713aSLionel Sambuc // RUN: cat %t | FileCheck %s -check-prefix=CHECK0 3f4a2713aSLionel Sambuc // RUN: cat %t | FileCheck %s -check-prefix=CHECK1 4f4a2713aSLionel Sambuc // RUN: cat %t | FileCheck %s -check-prefix=CHECK2 5f4a2713aSLionel Sambuc // 6f4a2713aSLionel Sambuc // This test ensures that we associate a declaration with the 7f4a2713aSLionel Sambuc // definition of the constructor for OuterClass. The declaration is 8f4a2713aSLionel Sambuc // necessary so the backend can emit the DW_AT_specification attribute 9f4a2713aSLionel Sambuc // for the definition. 10f4a2713aSLionel Sambuc // 11f4a2713aSLionel Sambuc // rdar://problem/13116508 12f4a2713aSLionel Sambuc 13f4a2713aSLionel Sambuc class Foo; 14f4a2713aSLionel Sambuc class OuterClass 15f4a2713aSLionel Sambuc { 16f4a2713aSLionel Sambuc static class InnerClass { 17f4a2713aSLionel Sambuc public: 18f4a2713aSLionel Sambuc InnerClass(); // Here createContextChain() generates a limited type for OuterClass. 19f4a2713aSLionel Sambuc } theInnerClass; 20*0a6a1f1dSLionel Sambuc // CHECK0: [[DECL:[0-9]+]] = {{.*}} ; [ DW_TAG_subprogram ] [line [[@LINE+1]]] [OuterClass] 21f4a2713aSLionel Sambuc OuterClass(const Foo *); // line 10 22f4a2713aSLionel Sambuc }; 23f4a2713aSLionel Sambuc OuterClass::InnerClass OuterClass::theInnerClass; // This toplevel decl causes InnerClass to be generated. 24*0a6a1f1dSLionel Sambuc // CHECK0: !"0x2e\00OuterClass\00{{.*}}\00[[@LINE+1]]"{{.*}}, ![[DECL]], {{![0-9]+}}} ; [ DW_TAG_subprogram ] [line [[@LINE+1]]] [def] [OuterClass] OuterClass(const Foo * meta)25f4a2713aSLionel SambucOuterClass::OuterClass(const Foo *meta) { } // line 13 26f4a2713aSLionel Sambuc 27f4a2713aSLionel Sambuc 28f4a2713aSLionel Sambuc 29f4a2713aSLionel Sambuc 30f4a2713aSLionel Sambuc 31*0a6a1f1dSLionel Sambuc 32f4a2713aSLionel Sambuc class Foo1; 33f4a2713aSLionel Sambuc class OuterClass1 34f4a2713aSLionel Sambuc { 35f4a2713aSLionel Sambuc static class InnerClass1 { 36f4a2713aSLionel Sambuc public: 37f4a2713aSLionel Sambuc InnerClass1(); 38f4a2713aSLionel Sambuc } theInnerClass1; 39*0a6a1f1dSLionel Sambuc // CHECK1: [[DECL:[0-9]+]] = {{.*}} ; [ DW_TAG_subprogram ] [line [[@LINE+2]]] [Bar] 40*0a6a1f1dSLionel Sambuc // CHECK1: !"0x2e\00Bar\00{{.*}}\00[[@LINE+4]]"{{.*}}, ![[DECL]], {{![0-9]+}}} ; [ DW_TAG_subprogram ] [line [[@LINE+4]]] [def] [Bar] 41f4a2713aSLionel Sambuc void Bar(const Foo1 *); 42f4a2713aSLionel Sambuc }; 43f4a2713aSLionel Sambuc OuterClass1::InnerClass1 OuterClass1::theInnerClass1; Bar(const Foo1 * meta)44f4a2713aSLionel Sambucvoid OuterClass1::Bar(const Foo1 *meta) { } 45f4a2713aSLionel Sambuc 46f4a2713aSLionel Sambuc 47f4a2713aSLionel Sambuc 48f4a2713aSLionel Sambuc 49f4a2713aSLionel Sambuc 50f4a2713aSLionel Sambuc class Foo2; 51f4a2713aSLionel Sambuc class OuterClass2 52f4a2713aSLionel Sambuc { 53f4a2713aSLionel Sambuc static class InnerClass2 { 54f4a2713aSLionel Sambuc public: 55f4a2713aSLionel Sambuc InnerClass2(); 56f4a2713aSLionel Sambuc } theInnerClass2; 57*0a6a1f1dSLionel Sambuc // CHECK2: [[DECL:[0-9]+]] = {{.*}} ; [ DW_TAG_subprogram ] [line [[@LINE+1]]] [~OuterClass2] 58f4a2713aSLionel Sambuc ~OuterClass2(); // line 10 59f4a2713aSLionel Sambuc }; 60f4a2713aSLionel Sambuc OuterClass2::InnerClass2 OuterClass2::theInnerClass2; 61*0a6a1f1dSLionel Sambuc // CHECK2: !"0x2e\00~OuterClass2\00{{.*}}\00[[@LINE+1]]"{{.*}}, ![[DECL]], {{.*}}} ; [ DW_TAG_subprogram ] [line [[@LINE+1]]] [def] [~OuterClass2] ~OuterClass2()62f4a2713aSLionel SambucOuterClass2::~OuterClass2() { } 63