annotate clang/test/CodeGen/dllexport.c @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 0572611fdcc8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -triple i686-windows-msvc -fms-extensions -emit-llvm -std=c11 -O0 -o - %s | FileCheck %s
anatofuz
parents:
diff changeset
2 // RUN: %clang_cc1 -triple x86_64-windows-msvc -fms-extensions -emit-llvm -std=c11 -O0 -o - %s | FileCheck %s
anatofuz
parents:
diff changeset
3 // RUN: %clang_cc1 -triple i686-windows-gnu -fms-extensions -emit-llvm -std=c11 -O0 -o - %s | FileCheck %s
anatofuz
parents:
diff changeset
4 // RUN: %clang_cc1 -triple x86_64-windows-gnu -fms-extensions -emit-llvm -std=c11 -O0 -o - %s | FileCheck %s
anatofuz
parents:
diff changeset
5
anatofuz
parents:
diff changeset
6
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8 //===----------------------------------------------------------------------===//
anatofuz
parents:
diff changeset
9 // Globals
anatofuz
parents:
diff changeset
10 //===----------------------------------------------------------------------===//
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 // Declarations are not exported.
anatofuz
parents:
diff changeset
13 // CHECK-NOT: @ExternGlobalDecl
anatofuz
parents:
diff changeset
14 __declspec(dllexport) extern int ExternGlobalDecl;
anatofuz
parents:
diff changeset
15
anatofuz
parents:
diff changeset
16 // dllexport implies a definition.
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
17 // CHECK-DAG: @GlobalDef = dso_local dllexport global i32 0, align 4
150
anatofuz
parents:
diff changeset
18 __declspec(dllexport) int GlobalDef;
anatofuz
parents:
diff changeset
19
anatofuz
parents:
diff changeset
20 // Export definition.
anatofuz
parents:
diff changeset
21 // CHECK-DAG: @GlobalInit = dso_local dllexport global i32 1, align 4
anatofuz
parents:
diff changeset
22 __declspec(dllexport) int GlobalInit = 1;
anatofuz
parents:
diff changeset
23
anatofuz
parents:
diff changeset
24 // Declare, then export definition.
anatofuz
parents:
diff changeset
25 // CHECK-DAG: @GlobalDeclInit = dso_local dllexport global i32 1, align 4
anatofuz
parents:
diff changeset
26 __declspec(dllexport) extern int GlobalDeclInit;
anatofuz
parents:
diff changeset
27 int GlobalDeclInit = 1;
anatofuz
parents:
diff changeset
28
anatofuz
parents:
diff changeset
29 // Redeclarations
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
30 // CHECK-DAG: @GlobalRedecl1 = dso_local dllexport global i32 0, align 4
150
anatofuz
parents:
diff changeset
31 __declspec(dllexport) extern int GlobalRedecl1;
anatofuz
parents:
diff changeset
32 __declspec(dllexport) int GlobalRedecl1;
anatofuz
parents:
diff changeset
33
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
34 // CHECK-DAG: @GlobalRedecl2 = dso_local dllexport global i32 0, align 4
150
anatofuz
parents:
diff changeset
35 __declspec(dllexport) extern int GlobalRedecl2;
anatofuz
parents:
diff changeset
36 int GlobalRedecl2;
anatofuz
parents:
diff changeset
37
anatofuz
parents:
diff changeset
38
anatofuz
parents:
diff changeset
39
anatofuz
parents:
diff changeset
40 //===----------------------------------------------------------------------===//
anatofuz
parents:
diff changeset
41 // Functions
anatofuz
parents:
diff changeset
42 //===----------------------------------------------------------------------===//
anatofuz
parents:
diff changeset
43
anatofuz
parents:
diff changeset
44 // Declarations are not exported.
anatofuz
parents:
diff changeset
45
anatofuz
parents:
diff changeset
46 // Export function definition.
anatofuz
parents:
diff changeset
47 // CHECK-DAG: define dso_local dllexport void @def()
anatofuz
parents:
diff changeset
48 __declspec(dllexport) void def(void) {}
anatofuz
parents:
diff changeset
49
anatofuz
parents:
diff changeset
50 // Export inline function.
anatofuz
parents:
diff changeset
51 // CHECK-DAG: define weak_odr dso_local dllexport void @inlineFunc()
anatofuz
parents:
diff changeset
52 // CHECK-DAG: define weak_odr dso_local dllexport void @externInlineFunc()
anatofuz
parents:
diff changeset
53 __declspec(dllexport) inline void inlineFunc(void) {}
anatofuz
parents:
diff changeset
54 __declspec(dllexport) inline void externInlineFunc(void) {}
anatofuz
parents:
diff changeset
55 extern void externInlineFunc(void);
anatofuz
parents:
diff changeset
56
anatofuz
parents:
diff changeset
57 // Redeclarations
anatofuz
parents:
diff changeset
58 // CHECK-DAG: define dso_local dllexport void @redecl1()
anatofuz
parents:
diff changeset
59 __declspec(dllexport) void redecl1(void);
anatofuz
parents:
diff changeset
60 __declspec(dllexport) void redecl1(void) {}
anatofuz
parents:
diff changeset
61
anatofuz
parents:
diff changeset
62 // CHECK-DAG: define dso_local dllexport void @redecl2()
anatofuz
parents:
diff changeset
63 __declspec(dllexport) void redecl2(void);
anatofuz
parents:
diff changeset
64 void redecl2(void) {}
anatofuz
parents:
diff changeset
65
anatofuz
parents:
diff changeset
66
anatofuz
parents:
diff changeset
67
anatofuz
parents:
diff changeset
68 //===----------------------------------------------------------------------===//
anatofuz
parents:
diff changeset
69 // Precedence
anatofuz
parents:
diff changeset
70 //===----------------------------------------------------------------------===//
anatofuz
parents:
diff changeset
71
anatofuz
parents:
diff changeset
72 // dllexport takes precedence over the dllimport if both are specified.
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
73 // CHECK-DAG: @PrecedenceGlobal1A = dso_local dllexport global i32 0, align 4
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
74 // CHECK-DAG: @PrecedenceGlobal1B = dso_local dllexport global i32 0, align 4
150
anatofuz
parents:
diff changeset
75 __attribute__((dllimport, dllexport)) int PrecedenceGlobal1A;
anatofuz
parents:
diff changeset
76 __declspec(dllimport) __declspec(dllexport) int PrecedenceGlobal1B;
anatofuz
parents:
diff changeset
77
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
78 // CHECK-DAG: @PrecedenceGlobal2A = dso_local dllexport global i32 0, align 4
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
79 // CHECK-DAG: @PrecedenceGlobal2B = dso_local dllexport global i32 0, align 4
150
anatofuz
parents:
diff changeset
80 __attribute__((dllexport, dllimport)) int PrecedenceGlobal2A;
anatofuz
parents:
diff changeset
81 __declspec(dllexport) __declspec(dllimport) int PrecedenceGlobal2B;
anatofuz
parents:
diff changeset
82
anatofuz
parents:
diff changeset
83 // CHECK-DAG: @PrecedenceGlobalRedecl1 = dso_local dllexport global i32 0, align 4
anatofuz
parents:
diff changeset
84 __declspec(dllexport) extern int PrecedenceGlobalRedecl1;
anatofuz
parents:
diff changeset
85 __declspec(dllimport) int PrecedenceGlobalRedecl1 = 0;
anatofuz
parents:
diff changeset
86
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
87 // CHECK-DAG: @PrecedenceGlobalRedecl2 = dso_local dllexport global i32 0, align 4
150
anatofuz
parents:
diff changeset
88 __declspec(dllimport) extern int PrecedenceGlobalRedecl2;
anatofuz
parents:
diff changeset
89 __declspec(dllexport) int PrecedenceGlobalRedecl2;
anatofuz
parents:
diff changeset
90
anatofuz
parents:
diff changeset
91 // CHECK-DAG: @PrecedenceGlobalMixed1 = dso_local dllexport global i32 1, align 4
anatofuz
parents:
diff changeset
92 __attribute__((dllexport)) extern int PrecedenceGlobalMixed1;
anatofuz
parents:
diff changeset
93 __declspec(dllimport) int PrecedenceGlobalMixed1 = 1;
anatofuz
parents:
diff changeset
94
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
95 // CHECK-DAG: @PrecedenceGlobalMixed2 = dso_local dllexport global i32 0, align 4
150
anatofuz
parents:
diff changeset
96 __attribute__((dllimport)) extern int PrecedenceGlobalMixed2;
anatofuz
parents:
diff changeset
97 __declspec(dllexport) int PrecedenceGlobalMixed2;
anatofuz
parents:
diff changeset
98
anatofuz
parents:
diff changeset
99 // CHECK-DAG: define dso_local dllexport void @precedence1A()
anatofuz
parents:
diff changeset
100 // CHECK-DAG: define dso_local dllexport void @precedence1B()
anatofuz
parents:
diff changeset
101 void __attribute__((dllimport, dllexport)) precedence1A(void) {}
anatofuz
parents:
diff changeset
102 void __declspec(dllimport) __declspec(dllexport) precedence1B(void) {}
anatofuz
parents:
diff changeset
103
anatofuz
parents:
diff changeset
104 // CHECK-DAG: define dso_local dllexport void @precedence2A()
anatofuz
parents:
diff changeset
105 // CHECK-DAG: define dso_local dllexport void @precedence2B()
anatofuz
parents:
diff changeset
106 void __attribute__((dllexport, dllimport)) precedence2A(void) {}
anatofuz
parents:
diff changeset
107 void __declspec(dllexport) __declspec(dllimport) precedence2B(void) {}
anatofuz
parents:
diff changeset
108
anatofuz
parents:
diff changeset
109 // CHECK-DAG: define dso_local dllexport void @precedenceRedecl1()
anatofuz
parents:
diff changeset
110 void __declspec(dllimport) precedenceRedecl1(void);
anatofuz
parents:
diff changeset
111 void __declspec(dllexport) precedenceRedecl1(void) {}
anatofuz
parents:
diff changeset
112
anatofuz
parents:
diff changeset
113 // CHECK-DAG: define dso_local dllexport void @precedenceRedecl2()
anatofuz
parents:
diff changeset
114 void __declspec(dllexport) precedenceRedecl2(void);
anatofuz
parents:
diff changeset
115 void __declspec(dllimport) precedenceRedecl2(void) {}