Douglas Katzman | 3459ce2 | 2015-10-08 04:24:12 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-apple-darwin -debug-info-kind=standalone -o - -emit-llvm %s | FileCheck %s |
David Blaikie | 03039fe | 2013-06-21 03:41:46 +0000 | [diff] [blame] | 2 | |
Reid Kleckner | 22466a92 | 2016-09-09 17:03:53 +0000 | [diff] [blame] | 3 | // We had a bug in -fstandalone-debug where UnicodeString would not be completed |
| 4 | // when it was required to be complete. This orginally manifested as an |
| 5 | // assertion in CodeView emission on Windows with some dllexport stuff, but it's |
| 6 | // more general than that. |
| 7 | |
| 8 | struct UnicodeString; |
Reid Kleckner | 6c7b1c6 | 2016-09-13 00:01:23 +0000 | [diff] [blame] | 9 | UnicodeString *force_fwd_decl; |
Reid Kleckner | 22466a92 | 2016-09-09 17:03:53 +0000 | [diff] [blame] | 10 | struct UnicodeString { |
| 11 | private: |
| 12 | virtual ~UnicodeString(); |
| 13 | }; |
| 14 | struct UseCompleteType { |
| 15 | UseCompleteType(); |
| 16 | ~UseCompleteType(); |
| 17 | UnicodeString currencySpcAfterSym[1]; |
| 18 | }; |
| 19 | UseCompleteType require_complete; |
| 20 | // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "UnicodeString" |
| 21 | // CHECK-NOT: DIFlagFwdDecl |
| 22 | // CHECK-SAME: ){{$}} |
| 23 | |
David Blaikie | 03039fe | 2013-06-21 03:41:46 +0000 | [diff] [blame] | 24 | namespace rdar14101097_1 { // see also PR16214 |
| 25 | // Check that we emit debug info for the definition of a struct if the |
| 26 | // definition is available, even if it's used via a pointer wrapped in a |
| 27 | // typedef. |
Duncan P. N. Exon Smith | 9dd4e4e | 2015-04-29 16:40:08 +0000 | [diff] [blame] | 28 | // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "foo" |
Duncan P. N. Exon Smith | f04be1f | 2015-03-03 17:25:55 +0000 | [diff] [blame] | 29 | // CHECK-NOT: DIFlagFwdDecl |
| 30 | // CHECK-SAME: ){{$}} |
David Blaikie | 03039fe | 2013-06-21 03:41:46 +0000 | [diff] [blame] | 31 | struct foo { |
| 32 | }; |
| 33 | |
| 34 | typedef foo *foop; |
| 35 | |
| 36 | void bar() { |
| 37 | foop f; |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | namespace rdar14101097_2 { |
| 42 | // As above, except trickier because we first encounter only a declaration of |
| 43 | // the type and no debug-info related use after we see the definition of the |
| 44 | // type. |
Duncan P. N. Exon Smith | 9dd4e4e | 2015-04-29 16:40:08 +0000 | [diff] [blame] | 45 | // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "foo" |
Duncan P. N. Exon Smith | f04be1f | 2015-03-03 17:25:55 +0000 | [diff] [blame] | 46 | // CHECK-NOT: DIFlagFwdDecl |
| 47 | // CHECK-SAME: ){{$}} |
David Blaikie | 03039fe | 2013-06-21 03:41:46 +0000 | [diff] [blame] | 48 | struct foo; |
| 49 | void bar() { |
| 50 | foo *f; |
| 51 | } |
| 52 | struct foo { |
| 53 | }; |
| 54 | } |