Douglas Katzman | 3459ce2 | 2015-10-08 04:24:12 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -std=c++11 -debug-info-kind=standalone -emit-llvm -triple x86_64-apple-darwin %s -o %t |
Adrian Prantl | ffcf4ba | 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; |
Duncan P. N. Exon Smith | 9dd4e4e | 2015-04-29 16:40:08 +0000 | [diff] [blame] | 20 | // CHECK0: ![[DECL:[0-9]+]] = !DISubprogram(name: "OuterClass" |
Duncan P. N. Exon Smith | f04be1f | 2015-03-03 17:25:55 +0000 | [diff] [blame] | 21 | // CHECK0-SAME: line: [[@LINE+2]] |
| 22 | // CHECK0-SAME: isDefinition: false |
Adrian Prantl | ffcf4ba | 2013-05-09 23:16:27 +0000 | [diff] [blame] | 23 | OuterClass(const Foo *); // line 10 |
| 24 | }; |
| 25 | OuterClass::InnerClass OuterClass::theInnerClass; // This toplevel decl causes InnerClass to be generated. |
Duncan P. N. Exon Smith | 9dd4e4e | 2015-04-29 16:40:08 +0000 | [diff] [blame] | 26 | // CHECK0: !DISubprogram(name: "OuterClass" |
Duncan P. N. Exon Smith | f04be1f | 2015-03-03 17:25:55 +0000 | [diff] [blame] | 27 | // CHECK0-SAME: line: [[@LINE+3]] |
| 28 | // CHECK0-SAME: isDefinition: true |
| 29 | // CHECK0-SAME: declaration: ![[DECL]] |
Adrian Prantl | ffcf4ba | 2013-05-09 23:16:27 +0000 | [diff] [blame] | 30 | OuterClass::OuterClass(const Foo *meta) { } // line 13 |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
Duncan P. N. Exon Smith | 3c51fa6 | 2014-10-03 20:01:52 +0000 | [diff] [blame] | 36 | |
Adrian Prantl | ffcf4ba | 2013-05-09 23:16:27 +0000 | [diff] [blame] | 37 | class Foo1; |
| 38 | class OuterClass1 |
| 39 | { |
| 40 | static class InnerClass1 { |
| 41 | public: |
| 42 | InnerClass1(); |
| 43 | } theInnerClass1; |
Duncan P. N. Exon Smith | 9dd4e4e | 2015-04-29 16:40:08 +0000 | [diff] [blame] | 44 | // CHECK1: ![[DECL:[0-9]+]] = !DISubprogram(name: "Bar" |
Duncan P. N. Exon Smith | f04be1f | 2015-03-03 17:25:55 +0000 | [diff] [blame] | 45 | // CHECK1-SAME: line: [[@LINE+2]] |
| 46 | // CHECK1-SAME: isDefinition: false |
Adrian Prantl | ffcf4ba | 2013-05-09 23:16:27 +0000 | [diff] [blame] | 47 | void Bar(const Foo1 *); |
| 48 | }; |
| 49 | OuterClass1::InnerClass1 OuterClass1::theInnerClass1; |
Duncan P. N. Exon Smith | 9dd4e4e | 2015-04-29 16:40:08 +0000 | [diff] [blame] | 50 | // CHECK1: !DISubprogram(name: "Bar" |
Duncan P. N. Exon Smith | f04be1f | 2015-03-03 17:25:55 +0000 | [diff] [blame] | 51 | // CHECK1-SAME: line: [[@LINE+3]] |
| 52 | // CHECK1-SAME: isDefinition: true |
| 53 | // CHECK1-SAME: declaration: ![[DECL]] |
Adrian Prantl | ffcf4ba | 2013-05-09 23:16:27 +0000 | [diff] [blame] | 54 | void 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; |
Duncan P. N. Exon Smith | 9dd4e4e | 2015-04-29 16:40:08 +0000 | [diff] [blame] | 67 | // CHECK2: ![[DECL:[0-9]+]] = !DISubprogram(name: "~OuterClass2" |
Duncan P. N. Exon Smith | f04be1f | 2015-03-03 17:25:55 +0000 | [diff] [blame] | 68 | // CHECK2-SAME: line: [[@LINE+2]] |
| 69 | // CHECK2-SAME: isDefinition: false |
Adrian Prantl | ffcf4ba | 2013-05-09 23:16:27 +0000 | [diff] [blame] | 70 | ~OuterClass2(); // line 10 |
| 71 | }; |
| 72 | OuterClass2::InnerClass2 OuterClass2::theInnerClass2; |
Duncan P. N. Exon Smith | 9dd4e4e | 2015-04-29 16:40:08 +0000 | [diff] [blame] | 73 | // CHECK4: !DISubprogram(name: "~OuterClass2" |
Duncan P. N. Exon Smith | f04be1f | 2015-03-03 17:25:55 +0000 | [diff] [blame] | 74 | // CHECK4-SAME: line: [[@LINE+3]] |
| 75 | // CHECK4-SAME: isDefinition: true |
| 76 | // CHECK4-SAME: declaration: ![[DECL]] |
Adrian Prantl | ffcf4ba | 2013-05-09 23:16:27 +0000 | [diff] [blame] | 77 | OuterClass2::~OuterClass2() { } |