blob: 95d32c400e1835b0b74d41fd63e3f827628a1286 [file] [log] [blame]
Rafael Espindolaff7cea82013-09-04 04:12:25 +00001// RUN: %clang_cc1 -std=c++11 -g -emit-llvm -g -triple x86_64-apple-darwin %s -o %t
Adrian Prantlffcf4ba2013-05-09 23:16:27 +00002// 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
13class Foo;
14class OuterClass
15{
16 static class InnerClass {
17 public:
18 InnerClass(); // Here createContextChain() generates a limited type for OuterClass.
19 } theInnerClass;
Adrian Prantl21361fb2014-08-29 22:44:27 +000020// CHECK0: [[DECL:[0-9]+]] = {{.*}} ; [ DW_TAG_subprogram ] [line [[@LINE+1]]] [OuterClass]
Adrian Prantlffcf4ba2013-05-09 23:16:27 +000021 OuterClass(const Foo *); // line 10
22};
23OuterClass::InnerClass OuterClass::theInnerClass; // This toplevel decl causes InnerClass to be generated.
Duncan P. N. Exon Smithb3a66692014-12-15 19:10:08 +000024// CHECK0: !"0x2e\00OuterClass\00{{.*}}\00[[@LINE+1]]"{{.*}}, ![[DECL]], {{![0-9]+}}} ; [ DW_TAG_subprogram ] [line [[@LINE+1]]] [def] [OuterClass]
Adrian Prantlffcf4ba2013-05-09 23:16:27 +000025OuterClass::OuterClass(const Foo *meta) { } // line 13
26
27
28
29
30
Duncan P. N. Exon Smith3c51fa62014-10-03 20:01:52 +000031
Adrian Prantlffcf4ba2013-05-09 23:16:27 +000032class Foo1;
33class OuterClass1
34{
35 static class InnerClass1 {
36 public:
37 InnerClass1();
38 } theInnerClass1;
Adrian Prantl21361fb2014-08-29 22:44:27 +000039// CHECK1: [[DECL:[0-9]+]] = {{.*}} ; [ DW_TAG_subprogram ] [line [[@LINE+2]]] [Bar]
Duncan P. N. Exon Smithb3a66692014-12-15 19:10:08 +000040// CHECK1: !"0x2e\00Bar\00{{.*}}\00[[@LINE+4]]"{{.*}}, ![[DECL]], {{![0-9]+}}} ; [ DW_TAG_subprogram ] [line [[@LINE+4]]] [def] [Bar]
Adrian Prantlffcf4ba2013-05-09 23:16:27 +000041 void Bar(const Foo1 *);
42};
43OuterClass1::InnerClass1 OuterClass1::theInnerClass1;
Adrian Prantlffcf4ba2013-05-09 23:16:27 +000044void OuterClass1::Bar(const Foo1 *meta) { }
45
46
47
48
49
50class Foo2;
51class OuterClass2
52{
53 static class InnerClass2 {
54 public:
55 InnerClass2();
56 } theInnerClass2;
Adrian Prantl21361fb2014-08-29 22:44:27 +000057// CHECK2: [[DECL:[0-9]+]] = {{.*}} ; [ DW_TAG_subprogram ] [line [[@LINE+1]]] [~OuterClass2]
Adrian Prantlffcf4ba2013-05-09 23:16:27 +000058 ~OuterClass2(); // line 10
59};
60OuterClass2::InnerClass2 OuterClass2::theInnerClass2;
Duncan P. N. Exon Smithb3a66692014-12-15 19:10:08 +000061// CHECK2: !"0x2e\00~OuterClass2\00{{.*}}\00[[@LINE+1]]"{{.*}}, ![[DECL]], {{.*}}} ; [ DW_TAG_subprogram ] [line [[@LINE+1]]] [def] [~OuterClass2]
Adrian Prantlffcf4ba2013-05-09 23:16:27 +000062OuterClass2::~OuterClass2() { }