blob: a434587a7875993eaf1390857551d5ed446183a5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
// The driver never checks to implicitly enable the explicit module build
// support unless at least two input files are provided.
// To trigger the C++20 module usage check, we always pass a second dummy file
// as input.
// TODO: Remove -fmodules everywhere once implicitly enabled explicit module
// builds are supported.
// RUN: split-file %s %t
//--- empty.cpp
// Nothing here
//--- only-global.cpp
// RUN: %clang -std=c++20 -ccc-print-phases -fmodules-driver -Rmodules-driver \
// RUN: %t/only-global.cpp %t/empty.cpp 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK1
// CHECK1: remark: found C++20 module usage in file '{{.*}}' [-Rmodules-driver]
module;
//--- only-import.cpp
// RUN: %clang -std=c++20 -ccc-print-phases -fmodules-driver -Rmodules-driver \
// RUN: %t/only-import.cpp %t/empty.cpp 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK2
// CHECK2: remark: found C++20 module usage in file '{{.*}}' [-Rmodules-driver]
import A;
//--- only-export.cpp
// RUN: %clang -std=c++20 -ccc-print-phases -fmodules-driver -Rmodules-driver \
// RUN: %t/only-export.cpp %t/empty.cpp 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK3
// CHECK3: remark: found C++20 module usage in file '{{.*}}' [-Rmodules-driver]
export module A;
//--- leading-line-comment.cpp
// RUN: %clang -std=c++20 -ccc-print-phases -fmodules-driver -Rmodules-driver \
// RUN: %t/leading-line-comment.cpp %t/empty.cpp 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK4
// CHECK4: remark: found C++20 module usage in file '{{.*}}' [-Rmodules-driver]
// My line comment
import A;
//--- leading-block-comment1.cpp
// RUN: %clang -std=c++20 -ccc-print-phases -fmodules-driver -Rmodules-driver \
// RUN: %t/leading-block-comment1.cpp %t/empty.cpp 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK5
// CHECK5: remark: found C++20 module usage in file '{{.*}}' [-Rmodules-driver]
/*My block comment */
import A;
//--- leading-block-comment2.cpp
// RUN: %clang -std=c++20 -ccc-print-phases -fmodules-driver -Rmodules-driver \
// RUN: %t/leading-block-comment2.cpp %t/empty.cpp 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK6
// CHECK6: remark: found C++20 module usage in file '{{.*}}' [-Rmodules-driver]
/*My line comment */ import A;
//--- inline-block-comment1.cpp
// RUN: %clang -std=c++20 -ccc-print-phases -fmodules-driver -Rmodules-driver \
// RUN: %t/leading-block-comment1.cpp %t/empty.cpp 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK7
// CHECK7: remark: found C++20 module usage in file '{{.*}}' [-Rmodules-driver]
export/*a comment*/module/*another comment*/A;
//--- inline-block-comment2.cpp
// RUN: %clang -std=c++20 -ccc-print-phases -fmodules-driver -Rmodules-driver \
// RUN: %t/leading-block-comment2.cpp %t/empty.cpp 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK8
// CHECK8: remark: found C++20 module usage in file '{{.*}}' [-Rmodules-driver]
module/*a comment*/;
//--- leading-directives.cpp
// RUN: %clang -std=c++23 -ccc-print-phases -fmodules-driver -Rmodules-driver \
// RUN: %t/leading-directives.cpp %t/empty.cpp 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK9
// CHECK9: remark: found C++20 module usage in file '{{.*}}' [-Rmodules-driver]
#define A
#undef A
#if A
#ifdef A
#elifdef A
#elifndef A
#endif
#ifndef A
#elif A
#else
#endif
#endif
#pragma once;
#include <iostream>
import m;
//--- multiline-directive.cpp
// RUN: %clang -std=c++23 -ccc-print-phases -fmodules-driver -Rmodules-driver \
// RUN: %t/multiline-directive.cpp %t/empty.cpp 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK10
// CHECK10: remark: found C++20 module usage in file '{{.*}}' [-Rmodules-driver]
#define MACRO(a, \
b) \
call((a), \
(b)
import a;
//--- leading-line-splice.cpp
// RUN: %clang -std=c++23 -ccc-print-phases -fmodules-driver -Rmodules-driver \
// RUN: %t/leading-line-splice.cpp %t/empty.cpp 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK11
// CHECK11: remark: found C++20 module usage in file '{{.*}}' [-Rmodules-driver]
\
module;
//--- leading-line-splice-trailing-whitespace.cpp
// RUN: %clang -std=c++23 -ccc-print-phases -fmodules-driver -Rmodules-driver \
// RUN: %t/leading-line-splice-trailing-whitespace.cpp %t/empty.cpp 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK12
// CHECK12: remark: found C++20 module usage in file '{{.*}}' [-Rmodules-driver]
// v This backslash has trailing whitespace.
\
export module A;
//--- comment-line-splice.cpp
// RUN: %clang -std=c++23 -ccc-print-phases -fmodules-driver -Rmodules-driver \
// RUN: %t/comment-line-splice.cpp %t/empty.cpp 2>&1 \
// RUN: | FileCheck %s --allow-empty --check-prefix=CHECK13
// CHECK13-NOT: remark: found C++20 module usage in file '{{.*}}' [-Rmodules-driver]
// My comment continues next-line!\
import A;
//--- comment-line-splice-trailing-whitespace.cpp
// RUN: %clang -std=c++23 -ccc-print-phases -fmodules-driver -Rmodules-driver \
// RUN: %t/comment-line-splice-trailing-whitespace.cpp %t/empty.cpp 2>&1 \
// RUN: | FileCheck %s --allow-empty --check-prefix=CHECK14
// CHECK14-NOT: remark: found C++20 module usage in file '{{.*}}' [-Rmodules-driver]
// My comment continues next-line! This backslash has trailing whitespace. -> \
module;
//--- line-splice-in-directive1.cpp
// RUN: %clang -std=c++23 -ccc-print-phases -fmodules-driver -Rmodules-driver \
// RUN: %t/line-splice-in-directive1.cpp %t/empty.cpp 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK15
// CHECK15: remark: found C++20 module usage in file '{{.*}}' [-Rmodules-driver]
module\
;
//--- line-splice-in-directive2.cpp
// RUN: %clang -std=c++23 -ccc-print-phases -fmodules-driver -Rmodules-driver \
// RUN: %t/line-splice-in-directive2.cpp %t/empty.cpp 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK16
// CHECK16: remark: found C++20 module usage in file '{{.*}}' [-Rmodules-driver]
export\
module\
A;
//--- no-module-usage1.cpp
// RUN: %clang -std=c++23 -ccc-print-phases -fmodules-driver -Rmodules-driver \
// RUN: %t/no-module-usage1.cpp %t/empty.cpp 2>&1 \
// RUN: | FileCheck %s --allow-empty --check-prefix=CHECK17
// CHECK17-NOT: remark: found C++20 module usage in file '{{.*}}' [-Rmodules-driver]
auto main() -> int {}
//--- no-module-usage2.cpp
// RUN: %clang -std=c++23 -ccc-print-phases -fmodules-driver -Rmodules-driver \
// RUN: %t/no-module-usage2.cpp %t/empty.cpp 2>&1 \
// RUN: | FileCheck %s --allow-empty --check-prefix=CHECK18
// CHECK18-NOT: remark: found C++20 module usage in file '{{.*}}' [-Rmodules-driver]
moduleStruct{};
//--- no-module-usage3.cpp
// RUN: %clang -std=c++23 -ccc-print-phases -fmodules-driver -Rmodules-driver \
// RUN: %t/no-module-usage3.cpp %t/empty.cpp 2>&1 \
// RUN: | FileCheck %s --allow-empty --check-prefix=CHECK19
// CHECK19-NOT: remark: found C++20 module usage in file '{{.*}}' [-Rmodules-driver]
export_struct{};
//--- no-module-usage-namespace-import.cpp
// RUN: %clang -std=c++23 -ccc-print-phases -fmodules-driver -Rmodules-driver \
// RUN: %t/no-module-usage-namespace-import.cpp %t/empty.cpp 2>&1 \
// RUN: | FileCheck %s --allow-empty --check-prefix=CHECK20
// CHECK20-NOT: remark: found C++20 module usage in file '{{.*}}' [-Rmodules-driver]
import::inner xi = {};
//--- no-module-usage-namespace-module.cpp
// RUN: %clang -std=c++23 -ccc-print-phases -fmodules-driver -Rmodules-driver \
// RUN: %t/no-module-usage-namespace-module.cpp %t/empty.cpp 2>&1 \
// RUN: | FileCheck %s --allow-empty --check-prefix=CHECK21
// CHECK21-NOT: remark: found C++20 module usage in file '{{.*}}' [-Rmodules-driver]
module::inner yi = {};
// RUN: not %clang -std=c++20 -ccc-print-phases -fmodules-driver -Rmodules-driver \
// RUN: imaginary-file.cpp %t/empty.cpp 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-NON-EXISTING-FILE-ERR
// CHECK-NON-EXISTING-FILE-ERR: clang: error: no such file or directory: 'imaginary-file.cpp'
|