Rafael Espindola | a3f55b0 | 2013-09-04 04:12:25 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -std=c++11 -g -emit-llvm -g -triple x86_64-apple-darwin %s -o %t |
Adrian Prantl | 0a050f7 | 2013-05-09 23:16:27 +0000 | [diff] [blame] | 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; |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 20 | // CHECK0: [[DECL:[0-9]+]] = {{.*}} ; [ DW_TAG_subprogram ] [line [[@LINE+1]]] [OuterClass] |
Adrian Prantl | 0a050f7 | 2013-05-09 23:16:27 +0000 | [diff] [blame] | 21 | OuterClass(const Foo *); // line 10 |
| 22 | }; |
| 23 | OuterClass::InnerClass OuterClass::theInnerClass; // This toplevel decl causes InnerClass to be generated. |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 24 | // CHECK0: metadata !"0x2e\00OuterClass\00{{.*}}\00[[@LINE+1]]"{{.*}}, metadata ![[DECL]], metadata {{![0-9]+}}} ; [ DW_TAG_subprogram ] [line [[@LINE+1]]] [def] [OuterClass] |
Adrian Prantl | 0a050f7 | 2013-05-09 23:16:27 +0000 | [diff] [blame] | 25 | OuterClass::OuterClass(const Foo *meta) { } // line 13 |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 31 | |
Adrian Prantl | 0a050f7 | 2013-05-09 23:16:27 +0000 | [diff] [blame] | 32 | class Foo1; |
| 33 | class OuterClass1 |
| 34 | { |
| 35 | static class InnerClass1 { |
| 36 | public: |
| 37 | InnerClass1(); |
| 38 | } theInnerClass1; |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 39 | // CHECK1: [[DECL:[0-9]+]] = {{.*}} ; [ DW_TAG_subprogram ] [line [[@LINE+2]]] [Bar] |
| 40 | // CHECK1: metadata !"0x2e\00Bar\00{{.*}}\00[[@LINE+4]]"{{.*}}, metadata ![[DECL]], metadata {{![0-9]+}}} ; [ DW_TAG_subprogram ] [line [[@LINE+4]]] [def] [Bar] |
Adrian Prantl | 0a050f7 | 2013-05-09 23:16:27 +0000 | [diff] [blame] | 41 | void Bar(const Foo1 *); |
| 42 | }; |
| 43 | OuterClass1::InnerClass1 OuterClass1::theInnerClass1; |
Adrian Prantl | 0a050f7 | 2013-05-09 23:16:27 +0000 | [diff] [blame] | 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; |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 57 | // CHECK2: [[DECL:[0-9]+]] = {{.*}} ; [ DW_TAG_subprogram ] [line [[@LINE+1]]] [~OuterClass2] |
Adrian Prantl | 0a050f7 | 2013-05-09 23:16:27 +0000 | [diff] [blame] | 58 | ~OuterClass2(); // line 10 |
| 59 | }; |
| 60 | OuterClass2::InnerClass2 OuterClass2::theInnerClass2; |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 61 | // CHECK2: metadata !"0x2e\00~OuterClass2\00{{.*}}\00[[@LINE+1]]"{{.*}}, metadata ![[DECL]], metadata {{.*}}} ; [ DW_TAG_subprogram ] [line [[@LINE+1]]] [def] [~OuterClass2] |
Adrian Prantl | 0a050f7 | 2013-05-09 23:16:27 +0000 | [diff] [blame] | 62 | OuterClass2::~OuterClass2() { } |