1 // RUN: %clang_cc1 -triple x86_64-apple-darwin -debug-info-kind=standalone -o - -emit-llvm %s | FileCheck %s
2 
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;
9 struct GetFwdDecl {
10   static UnicodeString format;
11 };
12 GetFwdDecl force_fwd_decl;
13 struct UnicodeString {
14 private:
15   virtual ~UnicodeString();
16 };
17 struct UseCompleteType {
18   UseCompleteType();
19   ~UseCompleteType();
20   UnicodeString currencySpcAfterSym[1];
21 };
22 UseCompleteType require_complete;
23 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "UnicodeString"
24 // CHECK-NOT:              DIFlagFwdDecl
25 // CHECK-SAME:             ){{$}}
26 
27 namespace rdar14101097_1 { // see also PR16214
28 // Check that we emit debug info for the definition of a struct if the
29 // definition is available, even if it's used via a pointer wrapped in a
30 // typedef.
31 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "foo"
32 // CHECK-NOT:              DIFlagFwdDecl
33 // CHECK-SAME:             ){{$}}
34 struct foo {
35 };
36 
37 typedef foo *foop;
38 
39 void bar() {
40   foop f;
41 }
42 }
43 
44 namespace rdar14101097_2 {
45 // As above, except trickier because we first encounter only a declaration of
46 // the type and no debug-info related use after we see the definition of the
47 // type.
48 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "foo"
49 // CHECK-NOT:              DIFlagFwdDecl
50 // CHECK-SAME:             ){{$}}
51 struct foo;
52 void bar() {
53   foo *f;
54 }
55 struct foo {
56 };
57 }
58