[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGenCXX / standalone-debug-attribute.cpp
bloba814e6f425ed6bf0e3ec12c7d43fb1d10640e080
1 // RUN: %clang_cc1 -DSETATTR=0 -triple x86_64-unknown-linux-gnu -emit-llvm -debug-info-kind=constructor %s -o - | FileCheck %s --check-prefix=DEBUG
2 // RUN: %clang_cc1 -DSETATTR=1 -triple x86_64-unknown-linux-gnu -emit-llvm -debug-info-kind=constructor %s -o - | FileCheck %s --check-prefix=WITHATTR
3 // Use -debug-info-kind=constructor because it includes all the optimizations.
5 #if SETATTR
6 #define STANDALONEDEBUGATTR __attribute__((standalone_debug))
7 #else
8 #define STANDALONEDEBUGATTR
9 #endif
11 struct STANDALONEDEBUGATTR StructWithConstructor {
12 StructWithConstructor() {}
14 void f(StructWithConstructor s) {}
15 // DEBUG: !DICompositeType({{.*}}name: "StructWithConstructor"
16 // DEBUG-SAME: flags: {{.*}}DIFlagFwdDecl
17 // WITHATTR: !DICompositeType({{.*}}name: "StructWithConstructor"
18 // WITHATTR-NOT: DIFlagFwdDecl
20 union STANDALONEDEBUGATTR UnionWithConstructor {
21 UnionWithConstructor() {}
23 void f(UnionWithConstructor u) {}
24 // DEBUG: !DICompositeType({{.*}}name: "UnionWithConstructor"
25 // DEBUG-SAME: flags: {{.*}}DIFlagFwdDecl
26 // WITHATTR: !DICompositeType({{.*}}name: "UnionWithConstructor"
27 // WITHATTR-NOT: DIFlagFwdDecl
29 template <typename T> struct ExternTemplate {
30 ExternTemplate() {}
31 T x;
33 extern template struct STANDALONEDEBUGATTR ExternTemplate<int>;
34 void f(ExternTemplate<int> s) {}
35 // DEBUG: !DICompositeType({{.*}}name: "ExternTemplate<int>"
36 // DEBUG-SAME: flags: {{.*}}DIFlagFwdDecl
37 // WITHATTR: !DICompositeType({{.*}}name: "ExternTemplate<int>"
38 // WITHATTR-NOT: DIFlagFwdDecl
40 struct STANDALONEDEBUGATTR CompleteTypeRequired {};
41 void f(CompleteTypeRequired &s) {}
42 // DEBUG: !DICompositeType({{.*}}name: "CompleteTypeRequired"
43 // DEBUG-SAME: flags: {{.*}}DIFlagFwdDecl
44 // WITHATTR: !DICompositeType({{.*}}name: "CompleteTypeRequired"
45 // WITHATTR-NOT: DIFlagFwdDecl
47 struct STANDALONEDEBUGATTR Redecl;
48 struct Redecl {};
49 void f(Redecl &s) {}
50 // DEBUG: !DICompositeType({{.*}}name: "Redecl"
51 // DEBUG-SAME: flags: {{.*}}DIFlagFwdDecl
52 // WITHATTR: !DICompositeType({{.*}}name: "Redecl"
53 // WITHATTR-NOT: DIFlagFwdDecl