1 // RUN: %clang_cc1 -DSETATTR=0 -triple x86_64-unknown-linux-gnu -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s --check-prefix=DEBUG
2 // RUN: %clang_cc1 -DSETATTR=1 -triple x86_64-unknown-linux-gnu -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s --check-prefix=WITHATTR
3 
4 #if SETATTR
5 #define STANDALONEDEBUGATTR __attribute__((standalone_debug))
6 #else
7 #define STANDALONEDEBUGATTR
8 #endif
9 
10 struct STANDALONEDEBUGATTR StructWithConstructor {
11   StructWithConstructor() {}
12 };
13 void f(StructWithConstructor s) {}
14 // DEBUG:  !DICompositeType({{.*}}name: "StructWithConstructor"
15 // DEBUG-SAME:              flags: {{.*}}DIFlagFwdDecl
16 // WITHATTR: !DICompositeType({{.*}}name: "StructWithConstructor"
17 // WITHATTR-NOT: DIFlagFwdDecl
18 
19 union STANDALONEDEBUGATTR UnionWithConstructor {
20   UnionWithConstructor() {}
21 };
22 void f(UnionWithConstructor u) {}
23 // DEBUG:  !DICompositeType({{.*}}name: "UnionWithConstructor"
24 // DEBUG-SAME:              flags: {{.*}}DIFlagFwdDecl
25 // WITHATTR: !DICompositeType({{.*}}name: "UnionWithConstructor"
26 // WITHATTR-NOT: DIFlagFwdDecl
27 
28 template <typename T> struct ExternTemplate {
29   ExternTemplate() {}
30   T x;
31 };
32 extern template struct STANDALONEDEBUGATTR ExternTemplate<int>;
33 void f(ExternTemplate<int> s) {}
34 // DEBUG: !DICompositeType({{.*}}name: "ExternTemplate<int>"
35 // DEBUG-SAME:             flags: {{.*}}DIFlagFwdDecl
36 // WITHATTR: !DICompositeType({{.*}}name: "ExternTemplate<int>"
37 // WITHATTR-NOT: DIFlagFwdDecl
38 
39 struct STANDALONEDEBUGATTR CompleteTypeRequired {};
40 void f(CompleteTypeRequired &s) {}
41 // DEBUG: !DICompositeType({{.*}}name: "CompleteTypeRequired"
42 // DEBUG-SAME:             flags: {{.*}}DIFlagFwdDecl
43 // WITHATTR: !DICompositeType({{.*}}name: "CompleteTypeRequired"
44 // WITHATTR-NOT: DIFlagFwdDecl
45 
46 struct STANDALONEDEBUGATTR Redecl;
47 struct Redecl {};
48 void f(Redecl &s) {}
49 // DEBUG: !DICompositeType({{.*}}name: "Redecl"
50 // DEBUG-SAME:             flags: {{.*}}DIFlagFwdDecl
51 // WITHATTR: !DICompositeType({{.*}}name: "Redecl"
52 // WITHATTR-NOT: DIFlagFwdDecl
53 
54