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]+]] = !MDSubprogram(name: "OuterClass" 21 // CHECK0-SAME: line: [[@LINE+2]] 22 // CHECK0-SAME: isDefinition: false 23 OuterClass(const Foo *); // line 10 24 }; 25 OuterClass::InnerClass OuterClass::theInnerClass; // This toplevel decl causes InnerClass to be generated. 26 // CHECK0: !MDSubprogram(name: "OuterClass" 27 // CHECK0-SAME: line: [[@LINE+3]] 28 // CHECK0-SAME: isDefinition: true 29 // CHECK0-SAME: declaration: ![[DECL]] OuterClass(const Foo * meta)30OuterClass::OuterClass(const Foo *meta) { } // line 13 31 32 33 34 35 36 37 class Foo1; 38 class OuterClass1 39 { 40 static class InnerClass1 { 41 public: 42 InnerClass1(); 43 } theInnerClass1; 44 // CHECK1: ![[DECL:[0-9]+]] = !MDSubprogram(name: "Bar" 45 // CHECK1-SAME: line: [[@LINE+2]] 46 // CHECK1-SAME: isDefinition: false 47 void Bar(const Foo1 *); 48 }; 49 OuterClass1::InnerClass1 OuterClass1::theInnerClass1; 50 // CHECK1: !MDSubprogram(name: "Bar" 51 // CHECK1-SAME: line: [[@LINE+3]] 52 // CHECK1-SAME: isDefinition: true 53 // CHECK1-SAME: declaration: ![[DECL]] Bar(const Foo1 * meta)54void OuterClass1::Bar(const Foo1 *meta) { } 55 56 57 58 59 60 class Foo2; 61 class OuterClass2 62 { 63 static class InnerClass2 { 64 public: 65 InnerClass2(); 66 } theInnerClass2; 67 // CHECK2: ![[DECL:[0-9]+]] = !MDSubprogram(name: "~OuterClass2" 68 // CHECK2-SAME: line: [[@LINE+2]] 69 // CHECK2-SAME: isDefinition: false 70 ~OuterClass2(); // line 10 71 }; 72 OuterClass2::InnerClass2 OuterClass2::theInnerClass2; 73 // CHECK4: !MDSubprogram(name: "~OuterClass2" 74 // CHECK4-SAME: line: [[@LINE+3]] 75 // CHECK4-SAME: isDefinition: true 76 // CHECK4-SAME: declaration: ![[DECL]] ~OuterClass2()77OuterClass2::~OuterClass2() { } 78