1 // RUN: %clang_cc1 -std=c++11 -g -emit-llvm -g -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 5 // 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 9 // for the definition. 10 // 11 // rdar://problem/13116508 12 13 class Foo; 14 class OuterClass 15 { 16 static class InnerClass { 17 public: 18 InnerClass(); // Here createContextChain() generates a limited type for OuterClass. 19 } theInnerClass; 20 // CHECK0: [[DECL:[0-9]+]] = {{.*}} ; [ DW_TAG_subprogram ] [line [[@LINE+1]]] [OuterClass] 21 OuterClass(const Foo *); // line 10 22 }; 23 OuterClass::InnerClass OuterClass::theInnerClass; // This toplevel decl causes InnerClass to be generated. 24 // CHECK0: !"0x2e\00OuterClass\00{{.*}}\00[[@LINE+1]]"{{.*}}, ![[DECL]], {{![0-9]+}}} ; [ DW_TAG_subprogram ] [line [[@LINE+1]]] [def] [OuterClass] OuterClass(const Foo * meta)25 OuterClass::OuterClass(const Foo *meta) { } // line 13 26 27 28 29 30 31 32 class Foo1; 33 class OuterClass1 34 { 35 static class InnerClass1 { 36 public: 37 InnerClass1(); 38 } theInnerClass1; 39 // CHECK1: [[DECL:[0-9]+]] = {{.*}} ; [ DW_TAG_subprogram ] [line [[@LINE+2]]] [Bar] 40 // CHECK1: !"0x2e\00Bar\00{{.*}}\00[[@LINE+4]]"{{.*}}, ![[DECL]], {{![0-9]+}}} ; [ DW_TAG_subprogram ] [line [[@LINE+4]]] [def] [Bar] 41 void Bar(const Foo1 *); 42 }; 43 OuterClass1::InnerClass1 OuterClass1::theInnerClass1; Bar(const Foo1 * meta)44 void OuterClass1::Bar(const Foo1 *meta) { } 45 46 47 48 49 50 class Foo2; 51 class OuterClass2 52 { 53 static class InnerClass2 { 54 public: 55 InnerClass2(); 56 } theInnerClass2; 57 // CHECK2: [[DECL:[0-9]+]] = {{.*}} ; [ DW_TAG_subprogram ] [line [[@LINE+1]]] [~OuterClass2] 58 ~OuterClass2(); // line 10 59 }; 60 OuterClass2::InnerClass2 OuterClass2::theInnerClass2; 61 // CHECK2: !"0x2e\00~OuterClass2\00{{.*}}\00[[@LINE+1]]"{{.*}}, ![[DECL]], {{.*}}} ; [ DW_TAG_subprogram ] [line [[@LINE+1]]] [def] [~OuterClass2] ~OuterClass2()62 OuterClass2::~OuterClass2() { } 63