Skip to content

Commit 953c124

Browse files
committed
[interop][SwiftToCxx] guard 'requires' clauses in __cpp_concepts #ifdefs
1 parent bf6d893 commit 953c124

File tree

7 files changed

+98
-1
lines changed

7 files changed

+98
-1
lines changed

lib/PrintAsClang/ClangSyntaxPrinter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ void ClangSyntaxPrinter::printGenericSignature(
284284
printGenericTypeParamTypeName(genericParamType);
285285
});
286286
os << ">\n";
287+
os << "#ifdef __cpp_concepts\n";
287288
os << "requires ";
288289
llvm::interleave(
289290
signature.getInnermostGenericParams(), os,
@@ -293,7 +294,7 @@ void ClangSyntaxPrinter::printGenericSignature(
293294
os << ">";
294295
},
295296
" && ");
296-
os << "\n";
297+
os << "\n#endif // __cpp_concepts\n";
297298
}
298299

299300
void ClangSyntaxPrinter::printGenericSignatureParams(

test/Interop/SwiftToCxx/generics/generic-enum-in-cxx.swift

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,23 @@ public func inoutConcreteOpt(_ x: inout GenericOpt<UInt16>) {
9090
}
9191

9292
// CHECK: template<class T_0_0>
93+
// CHECK-NEXT: #ifdef __cpp_concepts
9394
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
95+
// CHECK-NEXT: #endif
9496
// CHECK-NEXT: class GenericOpt;
9597

9698
// CHECK: template<class T_0_0>
99+
// CHECK-NEXT: #ifdef __cpp_concepts
97100
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
101+
// CHECK-NEXT: #endif
98102
// CHECK-NEXT: class _impl_GenericOpt;
99103

100104
// CHECK: SWIFT_EXTERN swift::_impl::MetadataResponseTy $s8Generics10GenericOptOMa(swift::_impl::MetadataRequestTy, void * _Nonnull) SWIFT_NOEXCEPT SWIFT_CALL;
101105

102106
// CHECK: template<class T_0_0>
107+
// CHECK-NEXT: #ifdef __cpp_concepts
103108
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
109+
// CHECK-NEXT: #endif
104110
// CHECK-NEXT: class GenericOpt final {
105111
// CHECK-NEXT: public:
106112
// CHECK-NEXT: inline ~GenericOpt() {
@@ -130,7 +136,9 @@ public func inoutConcreteOpt(_ x: inout GenericOpt<UInt16>) {
130136
// CHECK: inline void method() const;
131137
// CHECK-NEXT: inline void reset();
132138
// CHECK-NEXT: template<class T_1_0>
139+
// CHECK-NEXT: #ifdef __cpp_concepts
133140
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_1_0>
141+
// CHECK-NEXT: #endif
134142
// CHECK-NEXT: inline T_1_0 genericMethod(const T_1_0& x) const;
135143
// CHECK-NEXT: inline swift::Int getComputedProp() const;
136144

@@ -141,7 +149,9 @@ public func inoutConcreteOpt(_ x: inout GenericOpt<UInt16>) {
141149

142150

143151
// CHECK: template<class T_0_0>
152+
// CHECK-NEXT: #ifdef __cpp_concepts
144153
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
154+
// CHECK-NEXT: #endif
145155
// CHECK-NEXT: inline void inoutGenericOpt(GenericOpt<T_0_0>& x, const T_0_0& y) noexcept {
146156
// CHECK-NEXT: return _impl::$s8Generics15inoutGenericOptyyAA0cD0OyxGz_xtlF(_impl::_impl_GenericOpt<T_0_0>::getOpaquePointer(x), swift::_impl::getOpaquePointer(y), swift::TypeMetadataTrait<T_0_0>::getTypeMetadata());
147157
// CHECK-NEXT: }
@@ -155,7 +165,9 @@ public func inoutConcreteOpt(_ x: inout GenericOpt<UInt16>) {
155165

156166

157167
// CHECK: template<class T_0_0>
168+
// CHECK-NEXT: #ifdef __cpp_concepts
158169
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
170+
// CHECK-NEXT: #endif
159171
// CHECK-NEXT: inline GenericOpt<T_0_0> makeGenericOpt(const T_0_0& x) noexcept SWIFT_WARN_UNUSED_RESULT {
160172
// CHECK-NEXT: return _impl::_impl_GenericOpt<T_0_0>::returnNewValue([&](char * _Nonnull result) {
161173
// CHECK-NEXT: _impl::$s8Generics14makeGenericOptyAA0cD0OyxGxlF(result, swift::_impl::getOpaquePointer(x), swift::TypeMetadataTrait<T_0_0>::getTypeMetadata());
@@ -169,18 +181,24 @@ public func inoutConcreteOpt(_ x: inout GenericOpt<UInt16>) {
169181

170182

171183
// CHECK: template<class T_0_0>
184+
// CHECK-NEXT: #ifdef __cpp_concepts
172185
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
186+
// CHECK-NEXT: #endif
173187
// CHECK-NEXT: inline void takeGenericOpt(const GenericOpt<T_0_0>& x) noexcept {
174188
// CHECK-NEXT: return _impl::$s8Generics14takeGenericOptyyAA0cD0OyxGlF(_impl::_impl_GenericOpt<T_0_0>::getOpaquePointer(x), swift::TypeMetadataTrait<T_0_0>::getTypeMetadata());
175189
// CHECK-NEXT: }
176190

177191
// CHECK: template<class T_0_0>
192+
// CHECK-NEXT: #ifdef __cpp_concepts
178193
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
194+
// CHECK-NEXT: #endif
179195
// CHECK-NEXT: inline bool GenericOpt<T_0_0>::isSome() const {
180196
// CHECK-NEXT: return *this == GenericOpt<T_0_0>::some;
181197
// CHECK-NEXT: }
182198
// CHECK-NEXT: template<class T_0_0>
199+
// CHECK-NEXT: #ifdef __cpp_concepts
183200
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
201+
// CHECK-NEXT: #endif
184202
// CHECK-NEXT: inline T_0_0 GenericOpt<T_0_0>::getSome() const {
185203
// CHECK-NEXT: if (!isSome()) abort();
186204
// CHECK-NEXT: alignas(GenericOpt) unsigned char buffer[sizeof(GenericOpt)];
@@ -203,29 +221,41 @@ public func inoutConcreteOpt(_ x: inout GenericOpt<UInt16>) {
203221
// CHECK-NEXT: }
204222
// CHECK-NEXT: }
205223
// CHECK-NEXT: template<class T_0_0>
224+
// CHECK-NEXT: #ifdef __cpp_concepts
206225
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
226+
// CHECK-NEXT: #endif
207227
// CHECK-NEXT: inline bool GenericOpt<T_0_0>::isNone() const {
208228
// CHECK-NEXT: return *this == GenericOpt<T_0_0>::none;
209229
// CHECK-NEXT: }
210230

211231
// CHECK: template<class T_0_0>
232+
// CHECK-NEXT: #ifdef __cpp_concepts
212233
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
234+
// CHECK-NEXT: #endif
213235
// CHECK-NEXT: inline void GenericOpt<T_0_0>::method() const {
214236
// CHECK-NEXT: return _impl::$s8Generics10GenericOptO6methodyyF(swift::TypeMetadataTrait<GenericOpt<T_0_0>>::getTypeMetadata(), _getOpaquePointer());
215237
// CHECK-NEXT: }
216238

217239
// CHECK: template<class T_0_0>
240+
// CHECK-NEXT: #ifdef __cpp_concepts
218241
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
242+
// CHECK-NEXT: #endif
219243
// CHECK-NEXT: void GenericOpt<T_0_0>::reset()
220244

221245
// CHECK: template<class T_0_0>
246+
// CHECK-NEXT: #ifdef __cpp_concepts
222247
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
248+
// CHECK-NEXT: #endif
223249
// CHECK-NEXT: template<class T_1_0>
250+
// CHECK-NEXT: #ifdef __cpp_concepts
224251
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_1_0>
252+
// CHECK-NEXT: #endif
225253
// CHECK-NEXT: inline T_1_0 GenericOpt<T_0_0>::genericMethod(const T_1_0& x) const {
226254

227255
// CHECK: template<class T_0_0>
256+
// CHECK-NEXT: #ifdef __cpp_concepts
228257
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
258+
// CHECK-NEXT: #endif
229259
// CHECK-NEXT: inline swift::Int GenericOpt<T_0_0>::getComputedProp() const {
230260
// CHECK-NEXT: return _impl::$s8Generics10GenericOptO12computedPropSivg(swift::TypeMetadataTrait<GenericOpt<T_0_0>>::getTypeMetadata(), _getOpaquePointer());
231261
// CHECK-NEXT: }

test/Interop/SwiftToCxx/generics/generic-function-in-cxx.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,36 +111,48 @@ public func createTestSmallStruct(_ x: UInt32) -> TestSmallStruct {
111111
// Skip templates in impl classes.
112112
// CHECK: _impl_TestSmallStruct
113113
// CHECK: template<class T_0_0>
114+
// CHECK-NEXT: #ifdef __cpp_concepts
114115
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
116+
// CHECK-NEXT: #endif
115117
// CHECK-NEXT: inline T_0_0 genericMethodPassThrough(const T_0_0& x) const;
116118
// CHECK-NEXT: template<class T_0_0>
119+
// CHECK-NEXT: #ifdef __cpp_concepts
117120
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
121+
// CHECK-NEXT: #endif
118122
// CHECK-NEXT: inline void genericMethodMutTake(const T_0_0& x);
119123
// CHECK: template<class T>
120124
// CHECK-NEXT: returnNewValue
121125

122126
// CHECK: template<class T_0_0>
127+
// CHECK-NEXT: #ifdef __cpp_concepts
123128
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
129+
// CHECK-NEXT: #endif
124130
// CHECK-NEXT: inline void genericPrintFunction(const T_0_0& x) noexcept {
125131
// CHECK-NEXT: return _impl::$s9Functions20genericPrintFunctionyyxlF(swift::_impl::getOpaquePointer(x), swift::TypeMetadataTrait<T_0_0>::getTypeMetadata());
126132
// CHECK-NEXT: }
127133

128134

129135
// CHECK: template<class T_0_0, class T_0_1>
136+
// CHECK-NEXT: #ifdef __cpp_concepts
130137
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0> && swift::isUsableInGenericContext<T_0_1>
138+
// CHECK-NEXT: #endif
131139
// CHECK-NEXT: inline void genericPrintFunctionMultiGeneric(swift::Int x, const T_0_0& t1, const T_0_0& t1p, swift::Int y, const T_0_1& t2) noexcept {
132140
// CHECK-NEXT: return _impl::$s9Functions32genericPrintFunctionMultiGenericyySi_xxSiq_tr0_lF(x, swift::_impl::getOpaquePointer(t1), swift::_impl::getOpaquePointer(t1p), y, swift::_impl::getOpaquePointer(t2), swift::TypeMetadataTrait<T_0_0>::getTypeMetadata(), swift::TypeMetadataTrait<T_0_1>::getTypeMetadata());
133141
// CHECK-NEXT: }
134142

135143

136144
// CHECK: template<class T_0_0>
145+
// CHECK-NEXT: #ifdef __cpp_concepts
137146
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
147+
// CHECK-NEXT: #endif
138148
// CHECK-NEXT: inline void genericPrintFunctionTwoArg(const T_0_0& x, swift::Int y) noexcept {
139149
// CHECK-NEXT: return _impl::$s9Functions26genericPrintFunctionTwoArgyyx_SitlF(swift::_impl::getOpaquePointer(x), y, swift::TypeMetadataTrait<T_0_0>::getTypeMetadata());
140150
// CHECK-NEXT: }
141151

142152
// CHECK: template<class T_0_0>
153+
// CHECK-NEXT: #ifdef __cpp_concepts
143154
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
155+
// CHECK-NEXT: #endif
144156
// CHECK-NEXT: inline T_0_0 genericRet(const T_0_0& x) noexcept SWIFT_WARN_UNUSED_RESULT {
145157
// CHECK-NEXT: if constexpr (std::is_base_of<::swift::_impl::RefCountedClass, T_0_0>::value) {
146158
// CHECK-NEXT: void *returnValue;
@@ -165,13 +177,17 @@ public func createTestSmallStruct(_ x: UInt32) -> TestSmallStruct {
165177
// CHECK-NEXT: }
166178

167179
// CHECK: template<class T_0_0>
180+
// CHECK-NEXT: #ifdef __cpp_concepts
168181
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
182+
// CHECK-NEXT: #endif
169183
// CHECK-NEXT: inline void genericSwap(T_0_0& x, T_0_0& y) noexcept {
170184
// CHECK-NEXT: return _impl::$s9Functions11genericSwapyyxz_xztlF(swift::_impl::getOpaquePointer(x), swift::_impl::getOpaquePointer(y), swift::TypeMetadataTrait<T_0_0>::getTypeMetadata());
171185
// CHECK-NEXT: }
172186

173187
// CHECK: template<class T_0_0>
188+
// CHECK-NEXT: #ifdef __cpp_concepts
174189
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
190+
// CHECK-NEXT: #endif
175191
// CHECK-NEXT: inline T_0_0 TestSmallStruct::genericMethodPassThrough(const T_0_0& x) const {
176192
// CHECK-NEXT: if constexpr (std::is_base_of<::swift::_impl::RefCountedClass, T_0_0>::value) {
177193
// CHECK-NEXT: void *returnValue;
@@ -195,7 +211,9 @@ public func createTestSmallStruct(_ x: UInt32) -> TestSmallStruct {
195211
// CHECK-NEXT: }
196212
// CHECK-NEXT: }
197213
// CHECK-NEXT: template<class T_0_0>
214+
// CHECK-NEXT: #ifdef __cpp_concepts
198215
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
216+
// CHECK-NEXT: #endif
199217
// CHECK-NEXT: inline void TestSmallStruct::genericMethodMutTake(const T_0_0& x) {
200218
// CHECK-NEXT: return _impl::$s9Functions15TestSmallStructV20genericMethodMutTakeyyxlF(swift::_impl::getOpaquePointer(x), swift::TypeMetadataTrait<T_0_0>::getTypeMetadata(), _getOpaquePointer());
201219
// CHECK-NEXT: }

test/Interop/SwiftToCxx/generics/generic-struct-in-cxx.swift

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,19 +201,25 @@ public func inoutConcretePair(_ x: UInt16, _ y: inout GenericPair<UInt16, UInt16
201201
// CHECK-NEXT: SWIFT_EXTERN void $s8Generics15takeGenericPairyyAA0cD0Vyxq_Gr0_lF(const void * _Nonnull x, void * _Nonnull , void * _Nonnull ) SWIFT_NOEXCEPT SWIFT_CALL; // takeGenericPair(_:)
202202

203203
// CHECK: template<class T_0_0, class T_0_1>
204+
// CHECK-NEXT: #ifdef __cpp_concepts
204205
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0> && swift::isUsableInGenericContext<T_0_1>
206+
// CHECK-NEXT: #endif
205207
// CHECK-NEXT: class GenericPair;
206208

207209
// CHECK: template<class T_0_0, class T_0_1>
210+
// CHECK-NEXT: #ifdef __cpp_concepts
208211
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0> && swift::isUsableInGenericContext<T_0_1>
212+
// CHECK-NEXT: #endif
209213
// CHECK-NEXT: class _impl_GenericPair;
210214
// CHECK-EMPTY:
211215
// CHECK-NEXT: static_assert(2 <= 3, "unsupported generic requirement list for metadata func");
212216
// CHECK-NEXT: // Type metadata accessor for GenericPair
213217
// CHECK-NEXT: SWIFT_EXTERN swift::_impl::MetadataResponseTy $s8Generics11GenericPairVMa(swift::_impl::MetadataRequestTy, void * _Nonnull, void * _Nonnull) SWIFT_NOEXCEPT SWIFT_CALL;
214218

215219
// CHECK: template<class T_0_0, class T_0_1>
220+
// CHECK-NEXT: #ifdef __cpp_concepts
216221
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0> && swift::isUsableInGenericContext<T_0_1>
222+
// CHECK-NEXT: #endif
217223
// CHECK-NEXT: class GenericPair final {
218224
// CHECK-NEXT: public:
219225
// CHECK-NEXT: inline ~GenericPair() {
@@ -224,7 +230,9 @@ public func inoutConcretePair(_ x: UInt16, _ y: inout GenericPair<UInt16, UInt16
224230
// CHECK-NEXT: }
225231

226232
// CHECK: template<class T_0_0, class T_0_1>
233+
// CHECK-NEXT: #ifdef __cpp_concepts
227234
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0> && swift::isUsableInGenericContext<T_0_1>
235+
// CHECK-NEXT: #endif
228236
// CHECK-NEXT: class _impl_GenericPair {
229237
// CHECK-NEXT: public:
230238
// CHECK-NEXT: static inline char * _Nonnull getOpaquePointer(GenericPair<T_0_0, T_0_1> &object) { return object._getOpaquePointer(); }
@@ -240,7 +248,9 @@ public func inoutConcretePair(_ x: UInt16, _ y: inout GenericPair<UInt16, UInt16
240248
// CHECK-NEXT: #pragma clang diagnostic push
241249
// CHECK-NEXT: #pragma clang diagnostic ignored "-Wc++17-extensions"
242250
// CHECK-NEXT: template<class T_0_0, class T_0_1>
251+
// CHECK-NEXT: #ifdef __cpp_concepts
243252
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0> && swift::isUsableInGenericContext<T_0_1>
253+
// CHECK-NEXT: #endif
244254
// CHECK-NEXT: struct TypeMetadataTrait<Generics::GenericPair<T_0_0, T_0_1>> {
245255
// CHECK-NEXT: static inline void * _Nonnull getTypeMetadata() {
246256
// CHECK-NEXT: return Generics::_impl::$s8Generics11GenericPairVMa(0, swift::TypeMetadataTrait<T_0_0>::getTypeMetadata(), swift::TypeMetadataTrait<T_0_1>::getTypeMetadata())._0;
@@ -256,13 +266,17 @@ public func inoutConcretePair(_ x: UInt16, _ y: inout GenericPair<UInt16, UInt16
256266
// CHECK-NEXT: }
257267

258268
// CHECK: template<class T_0_0, class T_0_1>
269+
// CHECK-NEXT: #ifdef __cpp_concepts
259270
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0> && swift::isUsableInGenericContext<T_0_1>
271+
// CHECK-NEXT: #endif
260272
// CHECK-NEXT: inline void inoutGenericPair(GenericPair<T_0_0, T_0_1>& x, const T_0_0& y) noexcept {
261273
// CHECK-NEXT: return _impl::$s8Generics16inoutGenericPairyyAA0cD0Vyxq_Gz_xtr0_lF(_impl::_impl_GenericPair<T_0_0, T_0_1>::getOpaquePointer(x), swift::_impl::getOpaquePointer(y), swift::TypeMetadataTrait<T_0_0>::getTypeMetadata(), swift::TypeMetadataTrait<T_0_1>::getTypeMetadata());
262274
// CHECK-NEXT: }
263275

264276
// CHECK: template<class T_0_0, class T_0_1>
277+
// CHECK-NEXT: #ifdef __cpp_concepts
265278
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0> && swift::isUsableInGenericContext<T_0_1>
279+
// CHECK-NEXT: #endif
266280
// CHECK-NEXT: inline GenericPair<T_0_0, T_0_1> makeGenericPair(const T_0_0& x, const T_0_1& y) noexcept SWIFT_WARN_UNUSED_RESULT {
267281
// CHECK-NEXT: return _impl::_impl_GenericPair<T_0_0, T_0_1>::returnNewValue([&](char * _Nonnull result) {
268282
// CHECK-NEXT: _impl::$s8Generics15makeGenericPairyAA0cD0Vyxq_Gx_q_tr0_lF(result, swift::_impl::getOpaquePointer(x), swift::_impl::getOpaquePointer(y), swift::TypeMetadataTrait<T_0_0>::getTypeMetadata(), swift::TypeMetadataTrait<T_0_1>::getTypeMetadata());
@@ -276,7 +290,9 @@ public func inoutConcretePair(_ x: UInt16, _ y: inout GenericPair<UInt16, UInt16
276290
// CHECK-NEXT: }
277291

278292
// CHECK: template<class T_0_0, class T_0_1>
293+
// CHECK-NEXT: #ifdef __cpp_concepts
279294
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0> && swift::isUsableInGenericContext<T_0_1>
295+
// CHECK-NEXT: #endif
280296
// CHECK-NEXT: inline GenericPair<T_0_0, T_0_1> passThroughGenericPair(const GenericPair<T_0_0, T_0_1>& x, const T_0_1& y) noexcept SWIFT_WARN_UNUSED_RESULT {
281297
// CHECK-NEXT: return _impl::_impl_GenericPair<T_0_0, T_0_1>::returnNewValue([&](char * _Nonnull result) {
282298
// CHECK-NEXT: _impl::$s8Generics22passThroughGenericPairyAA0dE0Vyxq_GAE_q_tr0_lF(result, _impl::_impl_GenericPair<T_0_0, T_0_1>::getOpaquePointer(x), swift::_impl::getOpaquePointer(y), swift::TypeMetadataTrait<T_0_0>::getTypeMetadata(), swift::TypeMetadataTrait<T_0_1>::getTypeMetadata());
@@ -288,13 +304,17 @@ public func inoutConcretePair(_ x: UInt16, _ y: inout GenericPair<UInt16, UInt16
288304
// CHECK-NEXT: }
289305

290306
// CHECK: template<class T_0_0, class T_0_1>
307+
// CHECK-NEXT: #ifdef __cpp_concepts
291308
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0> && swift::isUsableInGenericContext<T_0_1>
309+
// CHECK-NEXT: #endif
292310
// CHECK-NEXT: inline void takeGenericPair(const GenericPair<T_0_0, T_0_1>& x) noexcept {
293311
// CHECK-NEXT: return _impl::$s8Generics15takeGenericPairyyAA0cD0Vyxq_Gr0_lF(_impl::_impl_GenericPair<T_0_0, T_0_1>::getOpaquePointer(x), swift::TypeMetadataTrait<T_0_0>::getTypeMetadata(), swift::TypeMetadataTrait<T_0_1>::getTypeMetadata());
294312
// CHECK-NEXT:}
295313

296314
// CHECK: template<class T_0_0, class T_0_1>
315+
// CHECK-NEXT: #ifdef __cpp_concepts
297316
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0> && swift::isUsableInGenericContext<T_0_1>
317+
// CHECK-NEXT: #endif
298318
// CHECK-NEXT: inline T_0_1 GenericPair<T_0_0, T_0_1>::getY() const {
299319
// CHECK-NEXT: if constexpr (std::is_base_of<::swift::_impl::RefCountedClass, T_0_1>::value) {
300320
// CHECK-NEXT: void *returnValue;
@@ -312,31 +332,43 @@ public func inoutConcretePair(_ x: UInt16, _ y: inout GenericPair<UInt16, UInt16
312332
// CHECK-NEXT: }
313333
// CHECK-NEXT: }
314334
// CHECK-NEXT: template<class T_0_0, class T_0_1>
335+
// CHECK-NEXT: #ifdef __cpp_concepts
315336
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0> && swift::isUsableInGenericContext<T_0_1>
337+
// CHECK-NEXT: #endif
316338
// CHECK-NEXT: inline void GenericPair<T_0_0, T_0_1>::setY(const T_0_1& value) {
317339
// CHECK-NEXT: return _impl::$s8Generics11GenericPairV1yq_vs(swift::_impl::getOpaquePointer(value), swift::TypeMetadataTrait<GenericPair<T_0_0, T_0_1>>::getTypeMetadata(), _getOpaquePointer());
318340
// CHECK-NEXT: }
319341
// CHECK-NEXT: template<class T_0_0, class T_0_1>
342+
// CHECK-NEXT: #ifdef __cpp_concepts
320343
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0> && swift::isUsableInGenericContext<T_0_1>
344+
// CHECK-NEXT: #endif
321345
// CHECK-NEXT: inline GenericPair<T_0_0, T_0_1> GenericPair<T_0_0, T_0_1>::init(const T_0_0& x, swift::Int i, const T_0_1& y) {
322346
// CHECK-NEXT: return _impl::_impl_GenericPair<T_0_0, T_0_1>::returnNewValue([&](char * _Nonnull result) {
323347
// CHECK-NEXT: _impl::$s8Generics11GenericPairVyACyxq_Gx_Siq_tcfC(result, swift::_impl::getOpaquePointer(x), i, swift::_impl::getOpaquePointer(y), swift::TypeMetadataTrait<T_0_0>::getTypeMetadata(), swift::TypeMetadataTrait<T_0_1>::getTypeMetadata());
324348
// CHECK-NEXT: });
325349
// CHECK-NEXT: }
326350
// CHECK-NEXT: template<class T_0_0, class T_0_1>
351+
// CHECK-NEXT: #ifdef __cpp_concepts
327352
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0> && swift::isUsableInGenericContext<T_0_1>
353+
// CHECK-NEXT: #endif
328354
// CHECK-NEXT: inline void GenericPair<T_0_0, T_0_1>::method() const {
329355
// CHECK-NEXT: return _impl::$s8Generics11GenericPairV6methodyyF(swift::TypeMetadataTrait<GenericPair<T_0_0, T_0_1>>::getTypeMetadata(), _getOpaquePointer());
330356
// CHECK-NEXT: }
331357
// CHECK-NEXT: template<class T_0_0, class T_0_1>
358+
// CHECK-NEXT: #ifdef __cpp_concepts
332359
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0> && swift::isUsableInGenericContext<T_0_1>
360+
// CHECK-NEXT: #endif
333361
// CHECK-NEXT: inline void GenericPair<T_0_0, T_0_1>::mutatingMethod(const GenericPair<T_0_1, T_0_0>& other) {
334362
// CHECK-NEXT: return _impl::$s8Generics11GenericPairV14mutatingMethodyyACyq_xGF(_impl::_impl_GenericPair<T_0_1, T_0_0>::getOpaquePointer(other), swift::TypeMetadataTrait<GenericPair<T_0_0, T_0_1>>::getTypeMetadata(), _getOpaquePointer());
335363
// CHECK-NEXT: }
336364
// CHECK-NEXT: template<class T_0_0, class T_0_1>
365+
// CHECK-NEXT: #ifdef __cpp_concepts
337366
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0> && swift::isUsableInGenericContext<T_0_1>
367+
// CHECK-NEXT: #endif
338368
// CHECK-NEXT: template<class T_1_0>
369+
// CHECK-NEXT: #ifdef __cpp_concepts
339370
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_1_0>
371+
// CHECK-NEXT: #endif
340372
// CHECK-NEXT: inline T_1_0 GenericPair<T_0_0, T_0_1>::genericMethod(const T_1_0& x, const T_0_1& y) const {
341373
// CHECK-NEXT: if constexpr (std::is_base_of<::swift::_impl::RefCountedClass, T_1_0>::value) {
342374
// CHECK-NEXT: void *returnValue;
@@ -354,7 +386,9 @@ public func inoutConcretePair(_ x: UInt16, _ y: inout GenericPair<UInt16, UInt16
354386
// CHECK-NEXT: }
355387
// CHECK-NEXT: }
356388
// CHECK-NEXT: template<class T_0_0, class T_0_1>
389+
// CHECK-NEXT: #ifdef __cpp_concepts
357390
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0> && swift::isUsableInGenericContext<T_0_1>
391+
// CHECK-NEXT: #endif
358392
// CHECK-NEXT: inline swift::Int GenericPair<T_0_0, T_0_1>::getComputedProp() const {
359393
// CHECK-NEXT: return _impl::$s8Generics11GenericPairV12computedPropSivg(swift::TypeMetadataTrait<GenericPair<T_0_0, T_0_1>>::getTypeMetadata(), _getOpaquePointer());
360394
// CHECK-NEXT: }

0 commit comments

Comments
 (0)