Skip to content

Commit 4b52ae0

Browse files
committed
[interop][SwiftToCxx] check that generics can be built in C++17/C++14 mode
1 parent 953c124 commit 4b52ae0

14 files changed

+97
-64
lines changed

lib/PrintAsClang/ClangSyntaxPrinter.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,3 +359,16 @@ void ClangSyntaxPrinter::printIncludeForShimHeader(StringRef headerName) {
359359
void ClangSyntaxPrinter::printDefine(StringRef macroName) {
360360
os << "#define " << macroName << "\n";
361361
}
362+
363+
void ClangSyntaxPrinter::printIgnoredDiagnosticBlock(
364+
StringRef diagName, llvm::function_ref<void()> bodyPrinter) {
365+
os << "#pragma clang diagnostic push\n";
366+
os << "#pragma clang diagnostic ignored \"-W" << diagName << "\"\n";
367+
bodyPrinter();
368+
os << "#pragma clang diagnostic pop\n";
369+
}
370+
371+
void ClangSyntaxPrinter::printIgnoredCxx17ExtensionDiagnosticBlock(
372+
llvm::function_ref<void()> bodyPrinter) {
373+
printIgnoredDiagnosticBlock("c++17-extensions", bodyPrinter);
374+
}

lib/PrintAsClang/ClangSyntaxPrinter.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,14 @@ class ClangSyntaxPrinter {
190190
// Print the #define for the given macro.
191191
void printDefine(StringRef macroName);
192192

193+
// Print the ignored Clang diagnostic preprocessor directives around the given
194+
// source.
195+
void printIgnoredDiagnosticBlock(StringRef diagName,
196+
llvm::function_ref<void()> bodyPrinter);
197+
198+
void printIgnoredCxx17ExtensionDiagnosticBlock(
199+
llvm::function_ref<void()> bodyPrinter);
200+
193201
protected:
194202
raw_ostream &os;
195203
};

lib/PrintAsClang/PrintClangFunction.cpp

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -986,17 +986,17 @@ void DeclAndTypeClangFunctionPrinter::printGenericReturnSequence(
986986
llvm::raw_string_ostream os(resultTyName);
987987
ClangSyntaxPrinter(os).printGenericTypeParamTypeName(gtpt);
988988
}
989-
990-
os << " if constexpr (std::is_base_of<::swift::"
991-
<< cxx_synthesis::getCxxImplNamespaceName() << "::RefCountedClass, "
992-
<< resultTyName << ">::value) {\n";
993-
os << " void *returnValue;\n ";
994-
if (!initializeWithTakeFromValue) {
995-
invocationPrinter(/*additionalParam=*/StringRef(ros.str()));
996-
} else {
997-
os << "returnValue = *reinterpret_cast<void **>("
998-
<< *initializeWithTakeFromValue << ")";
999-
}
989+
ClangSyntaxPrinter(os).printIgnoredCxx17ExtensionDiagnosticBlock([&]() {
990+
os << " if constexpr (std::is_base_of<::swift::"
991+
<< cxx_synthesis::getCxxImplNamespaceName() << "::RefCountedClass, "
992+
<< resultTyName << ">::value) {\n";
993+
os << " void *returnValue;\n ";
994+
if (!initializeWithTakeFromValue) {
995+
invocationPrinter(/*additionalParam=*/StringRef(ros.str()));
996+
} else {
997+
os << "returnValue = *reinterpret_cast<void **>("
998+
<< *initializeWithTakeFromValue << ")";
999+
}
10001000
os << ";\n";
10011001
os << " return ::swift::" << cxx_synthesis::getCxxImplNamespaceName()
10021002
<< "::implClassFor<" << resultTyName
@@ -1010,34 +1010,35 @@ void DeclAndTypeClangFunctionPrinter::printGenericReturnSequence(
10101010
<< ">::type::returnNewValue([&](void * _Nonnull returnValue) {\n";
10111011
if (!initializeWithTakeFromValue) {
10121012
invocationPrinter(/*additionalParam=*/StringRef("returnValue"));
1013-
} else {
1014-
os << " return ::swift::" << cxx_synthesis::getCxxImplNamespaceName()
1015-
<< "::implClassFor<" << resultTyName
1016-
<< ">::type::initializeWithTake(reinterpret_cast<char * "
1017-
"_Nonnull>(returnValue), "
1018-
<< *initializeWithTakeFromValue << ")";
1019-
}
1020-
os << ";\n });\n";
1021-
os << " } else if constexpr (::swift::"
1022-
<< cxx_synthesis::getCxxImplNamespaceName() << "::isSwiftBridgedCxxRecord<"
1023-
<< resultTyName << ">) {\n";
1024-
if (!initializeWithTakeFromValue) {
1025-
ClangTypeHandler::printGenericReturnScaffold(os, resultTyName,
1026-
invocationPrinter);
1027-
} else {
1028-
// FIXME: support taking a C++ record type.
1029-
os << "abort();\n";
1030-
}
1031-
os << " } else {\n";
1032-
os << " " << resultTyName << " returnValue;\n";
1033-
if (!initializeWithTakeFromValue) {
1034-
invocationPrinter(/*additionalParam=*/StringRef(ros.str()));
1035-
} else {
1036-
os << "memcpy(&returnValue, " << *initializeWithTakeFromValue
1037-
<< ", sizeof(returnValue))";
1038-
}
1039-
os << ";\n return returnValue;\n";
1040-
os << " }\n";
1013+
} else {
1014+
os << " return ::swift::" << cxx_synthesis::getCxxImplNamespaceName()
1015+
<< "::implClassFor<" << resultTyName
1016+
<< ">::type::initializeWithTake(reinterpret_cast<char * "
1017+
"_Nonnull>(returnValue), "
1018+
<< *initializeWithTakeFromValue << ")";
1019+
}
1020+
os << ";\n });\n";
1021+
os << " } else if constexpr (::swift::"
1022+
<< cxx_synthesis::getCxxImplNamespaceName()
1023+
<< "::isSwiftBridgedCxxRecord<" << resultTyName << ">) {\n";
1024+
if (!initializeWithTakeFromValue) {
1025+
ClangTypeHandler::printGenericReturnScaffold(os, resultTyName,
1026+
invocationPrinter);
1027+
} else {
1028+
// FIXME: support taking a C++ record type.
1029+
os << "abort();\n";
1030+
}
1031+
os << " } else {\n";
1032+
os << " " << resultTyName << " returnValue;\n";
1033+
if (!initializeWithTakeFromValue) {
1034+
invocationPrinter(/*additionalParam=*/StringRef(ros.str()));
1035+
} else {
1036+
os << "memcpy(&returnValue, " << *initializeWithTakeFromValue
1037+
<< ", sizeof(returnValue))";
1038+
}
1039+
os << ";\n return returnValue;\n";
1040+
os << " }\n";
1041+
});
10411042
}
10421043

10431044
void DeclAndTypeClangFunctionPrinter::printCxxThunkBody(

lib/PrintAsClang/PrintSwiftToClangCoreScaffold.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,9 @@ void swift::printSwiftToClangCoreScaffold(SwiftToClangInteropContext &ctx,
243243
});
244244
os << "\n";
245245
// C++ only supports inline variables from C++17.
246-
// FIXME: silence the warning instead?
247-
os << "#if __cplusplus > 201402L\n";
248-
printPrimitiveGenericTypeTraits(os, astContext, typeMapping,
249-
/*isCForwardDefinition=*/false);
250-
os << "#endif\n";
246+
ClangSyntaxPrinter(os).printIgnoredCxx17ExtensionDiagnosticBlock([&]() {
247+
printPrimitiveGenericTypeTraits(os, astContext, typeMapping,
248+
/*isCForwardDefinition=*/false);
249+
});
251250
});
252251
}

test/Interop/SwiftToCxx/core/swift-impl-defs-in-cxx.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@
114114
// CHECK-NEXT: } // namespace _impl
115115
// CHECK-EMPTY:
116116
// CHECK-EMPTY:
117-
// CHECK-NEXT: #if __cplusplus > 201402L
117+
// CHECK-NEXT: #pragma clang diagnostic push
118+
// CHECK-NEXT: #pragma clang diagnostic ignored "-Wc++17-extensions"
118119
// CHECK-NEXT: template<>
119120
// CHECK-NEXT: static inline const constexpr bool isUsableInGenericContext<bool> = true;
120121
// CHECK-EMPTY:
@@ -235,7 +236,7 @@
235236
// CHECK-NEXT: }
236237
// CHECK-NEXT: };
237238
// CHECK-EMPTY:
238-
// CHECK-NEXT: #endif
239+
// CHECK-NEXT: #pragma clang diagnostic pop
239240
// CHECK-EMPTY:
240241
// CHECK-NEXT: } // namespace swift
241242
// CHECK-EMPTY:

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend %s -typecheck -module-name Generics -clang-header-expose-decls=all-public -emit-clang-header-path %t/generics.h
33
// RUN: %FileCheck %s < %t/generics.h
4-
// RUN: %check-generic-interop-cxx-header-in-clang(%t/generics.h -Wno-reserved-identifier)
4+
// RUN: %check-interop-cxx-header-in-clang(%t/generics.h -Wno-reserved-identifier)
55

66
// RUN: %empty-directory(%t)
77
// RUN: %target-swift-frontend %s -enable-library-evolution -typecheck -module-name Generics -clang-header-expose-decls=all-public -emit-clang-header-path %t/generics.h
88
// RUN: %FileCheck %s < %t/generics.h
9-
// RUN: %check-generic-interop-cxx-header-in-clang(%t/generics.h -Wno-reserved-identifier)
9+
// RUN: %check-interop-cxx-header-in-clang(%t/generics.h -Wno-reserved-identifier)
1010

1111
// FIXME: remove the need for -Wno-reserved-identifier
1212

@@ -204,6 +204,8 @@ public func inoutConcreteOpt(_ x: inout GenericOpt<UInt16>) {
204204
// CHECK-NEXT: alignas(GenericOpt) unsigned char buffer[sizeof(GenericOpt)];
205205
// CHECK-NEXT: auto *thisCopy = new(buffer) GenericOpt(*this);
206206
// CHECK-NEXT: char * _Nonnull payloadFromDestruction = thisCopy->_destructiveProjectEnumData();
207+
// CHECK-NEXT: #pragma clang diagnostic push
208+
// CHECK-NEXT: #pragma clang diagnostic ignored "-Wc++17-extensions"
207209
// CHECK-NEXT: if constexpr (std::is_base_of<::swift::_impl::RefCountedClass, T_0_0>::value) {
208210
// CHECK-NEXT: void *returnValue;
209211
// CHECK-NEXT: returnValue = *reinterpret_cast<void **>(payloadFromDestruction);
@@ -219,6 +221,7 @@ public func inoutConcreteOpt(_ x: inout GenericOpt<UInt16>) {
219221
// CHECK-NEXT: memcpy(&returnValue, payloadFromDestruction, sizeof(returnValue));
220222
// CHECK-NEXT: return returnValue;
221223
// CHECK-NEXT: }
224+
// CHECK-NEXT: #pragma clang diagnostic pop
222225
// CHECK-NEXT: }
223226
// CHECK-NEXT: template<class T_0_0>
224227
// CHECK-NEXT: #ifdef __cpp_concepts

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
// RUN: %target-swift-frontend %s -typecheck -module-name Functions -clang-header-expose-decls=all-public -emit-clang-header-path %t/functions.h
33
// RUN: %FileCheck %s < %t/functions.h
44

5-
// RUN: %check-generic-interop-cxx-header-in-clang(%t/functions.h -Wno-unused-function)
5+
// RUN: %check-interop-cxx-header-in-clang(%t/functions.h -Wno-unused-function)
66

77
// RUN: %target-swift-frontend %s -typecheck -module-name Functions -enable-library-evolution -clang-header-expose-decls=all-public -emit-clang-header-path %t/functions-evo.h
88
// RUN: %FileCheck %s < %t/functions-evo.h
99

10-
// RUN: %check-generic-interop-cxx-header-in-clang(%t/functions-evo.h -Wno-unused-function)
10+
// RUN: %check-interop-cxx-header-in-clang(%t/functions-evo.h -Wno-unused-function)
1111

1212
public func genericPrintFunctionTwoArg<T>(_ x: T, _ y: Int) {
1313
print("X:", x)
@@ -154,6 +154,8 @@ public func createTestSmallStruct(_ x: UInt32) -> TestSmallStruct {
154154
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
155155
// CHECK-NEXT: #endif
156156
// CHECK-NEXT: inline T_0_0 genericRet(const T_0_0& x) noexcept SWIFT_WARN_UNUSED_RESULT {
157+
// CHECK-NEXT: #pragma clang diagnostic push
158+
// CHECK-NEXT: #pragma clang diagnostic ignored "-Wc++17-extensions"
157159
// CHECK-NEXT: if constexpr (std::is_base_of<::swift::_impl::RefCountedClass, T_0_0>::value) {
158160
// CHECK-NEXT: void *returnValue;
159161
// CHECK-NEXT: _impl::$s9Functions10genericRetyxxlF(reinterpret_cast<void *>(&returnValue), swift::_impl::getOpaquePointer(x), swift::TypeMetadataTrait<T_0_0>::getTypeMetadata());
@@ -174,6 +176,7 @@ public func createTestSmallStruct(_ x: UInt32) -> TestSmallStruct {
174176
// CHECK-NEXT: _impl::$s9Functions10genericRetyxxlF(reinterpret_cast<void *>(&returnValue), swift::_impl::getOpaquePointer(x), swift::TypeMetadataTrait<T_0_0>::getTypeMetadata());
175177
// CHECK-NEXT: return returnValue;
176178
// CHECK-NEXT: }
179+
// CHECK-NEXT: #pragma clang diagnostic pop
177180
// CHECK-NEXT: }
178181

179182
// CHECK: template<class T_0_0>
@@ -189,6 +192,8 @@ public func createTestSmallStruct(_ x: UInt32) -> TestSmallStruct {
189192
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
190193
// CHECK-NEXT: #endif
191194
// CHECK-NEXT: inline T_0_0 TestSmallStruct::genericMethodPassThrough(const T_0_0& x) const {
195+
// CHECK-NEXT: #pragma clang diagnostic push
196+
// CHECK-NEXT: #pragma clang diagnostic ignored "-Wc++17-extensions"
192197
// CHECK-NEXT: if constexpr (std::is_base_of<::swift::_impl::RefCountedClass, T_0_0>::value) {
193198
// CHECK-NEXT: void *returnValue;
194199
// CHECK-NEXT: _impl::$s9Functions15TestSmallStructV24genericMethodPassThroughyxxlF(reinterpret_cast<void *>(&returnValue), swift::_impl::getOpaquePointer(x), _impl::swift_interop_passDirect_Functions_uint32_t_0_4(_getOpaquePointer()), swift::TypeMetadataTrait<T_0_0>::getTypeMetadata());
@@ -209,6 +214,7 @@ public func createTestSmallStruct(_ x: UInt32) -> TestSmallStruct {
209214
// CHECK-NEXT: _impl::$s9Functions15TestSmallStructV24genericMethodPassThroughyxxlF(reinterpret_cast<void *>(&returnValue), swift::_impl::getOpaquePointer(x), _impl::swift_interop_passDirect_Functions_uint32_t_0_4(_getOpaquePointer()), swift::TypeMetadataTrait<T_0_0>::getTypeMetadata());
210215
// CHECK-NEXT: return returnValue;
211216
// CHECK-NEXT: }
217+
// CHECK-NEXT: #pragma clang diagnostic pop
212218
// CHECK-NEXT: }
213219
// CHECK-NEXT: template<class T_0_0>
214220
// CHECK-NEXT: #ifdef __cpp_concepts

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend %s -typecheck -module-name Generics -clang-header-expose-decls=all-public -emit-clang-header-path %t/generics.h
33
// RUN: %FileCheck %s < %t/generics.h
4-
// RUN: %check-generic-interop-cxx-header-in-clang(%t/generics.h -Wno-reserved-identifier)
4+
// RUN: %check-interop-cxx-header-in-clang(%t/generics.h -Wno-reserved-identifier)
55

66
// Check that an instantiation compiles too.
77
// RUN: echo "constexpr int x = sizeof(Generics::GenericPair<int, int>);" >> %t/generics.h
8-
// RUN: %check-generic-interop-cxx-header-in-clang(%t/generics.h -Wno-reserved-identifier)
8+
// RUN: %check-interop-cxx-header-in-clang(%t/generics.h -Wno-reserved-identifier)
99

1010
// RUN: %empty-directory(%t)
1111
// RUN: %target-swift-frontend %s -enable-library-evolution -typecheck -module-name Generics -clang-header-expose-decls=all-public -emit-clang-header-path %t/generics.h
1212
// RUN: %FileCheck %s < %t/generics.h
13-
// RUN: %check-generic-interop-cxx-header-in-clang(%t/generics.h -Wno-reserved-identifier)
13+
// RUN: %check-interop-cxx-header-in-clang(%t/generics.h -Wno-reserved-identifier)
1414

1515
// FIXME: remove the need for -Wno-reserved-identifier
1616

@@ -316,6 +316,8 @@ public func inoutConcretePair(_ x: UInt16, _ y: inout GenericPair<UInt16, UInt16
316316
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0> && swift::isUsableInGenericContext<T_0_1>
317317
// CHECK-NEXT: #endif
318318
// CHECK-NEXT: inline T_0_1 GenericPair<T_0_0, T_0_1>::getY() const {
319+
// CHECK-NEXT: #pragma clang diagnostic push
320+
// CHECK-NEXT: #pragma clang diagnostic ignored "-Wc++17-extensions"
319321
// CHECK-NEXT: if constexpr (std::is_base_of<::swift::_impl::RefCountedClass, T_0_1>::value) {
320322
// CHECK-NEXT: void *returnValue;
321323
// CHECK-NEXT: _impl::$s8Generics11GenericPairV1yq_vg(reinterpret_cast<void *>(&returnValue), swift::TypeMetadataTrait<GenericPair<T_0_0, T_0_1>>::getTypeMetadata(), _getOpaquePointer());
@@ -330,6 +332,7 @@ public func inoutConcretePair(_ x: UInt16, _ y: inout GenericPair<UInt16, UInt16
330332
// CHECK-NEXT: _impl::$s8Generics11GenericPairV1yq_vg(reinterpret_cast<void *>(&returnValue), swift::TypeMetadataTrait<GenericPair<T_0_0, T_0_1>>::getTypeMetadata(), _getOpaquePointer());
331333
// CHECK-NEXT: return returnValue;
332334
// CHECK-NEXT: }
335+
// CHECK-NEXT: #pragma clang diagnostic pop
333336
// CHECK-NEXT: }
334337
// CHECK-NEXT: template<class T_0_0, class T_0_1>
335338
// CHECK-NEXT: #ifdef __cpp_concepts
@@ -370,6 +373,8 @@ public func inoutConcretePair(_ x: UInt16, _ y: inout GenericPair<UInt16, UInt16
370373
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_1_0>
371374
// CHECK-NEXT: #endif
372375
// 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 {
376+
// CHECK-NEXT: #pragma clang diagnostic push
377+
// CHECK-NEXT: #pragma clang diagnostic ignored "-Wc++17-extensions"
373378
// CHECK-NEXT: if constexpr (std::is_base_of<::swift::_impl::RefCountedClass, T_1_0>::value) {
374379
// CHECK-NEXT: void *returnValue;
375380
// CHECK-NEXT: _impl::$s8Generics11GenericPairV13genericMethodyqd__qd___q_tlF(reinterpret_cast<void *>(&returnValue), swift::_impl::getOpaquePointer(x), swift::_impl::getOpaquePointer(y), swift::TypeMetadataTrait<GenericPair<T_0_0, T_0_1>>::getTypeMetadata(), swift::TypeMetadataTrait<T_1_0>::getTypeMetadata(), _getOpaquePointer());
@@ -384,6 +389,7 @@ public func inoutConcretePair(_ x: UInt16, _ y: inout GenericPair<UInt16, UInt16
384389
// CHECK-NEXT: _impl::$s8Generics11GenericPairV13genericMethodyqd__qd___q_tlF(reinterpret_cast<void *>(&returnValue), swift::_impl::getOpaquePointer(x), swift::_impl::getOpaquePointer(y), swift::TypeMetadataTrait<GenericPair<T_0_0, T_0_1>>::getTypeMetadata(), swift::TypeMetadataTrait<T_1_0>::getTypeMetadata(), _getOpaquePointer());
385390
// CHECK-NEXT: return returnValue;
386391
// CHECK-NEXT: }
392+
// CHECK-NEXT: #pragma clang diagnostic pop
387393
// CHECK-NEXT: }
388394
// CHECK-NEXT: template<class T_0_0, class T_0_1>
389395
// CHECK-NEXT: #ifdef __cpp_concepts

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend %S/generic-struct-in-cxx.swift -D KNOWN_LAYOUT -typecheck -module-name Generics -clang-header-expose-decls=all-public -emit-clang-header-path %t/generics.h
33
// RUN: %FileCheck %s < %t/generics.h
4-
// RUN: %check-generic-interop-cxx-header-in-clang(%t/generics.h -Wno-reserved-identifier)
4+
// RUN: %check-interop-cxx-header-in-clang(%t/generics.h -Wno-reserved-identifier)
55

66
// RUN: %empty-directory(%t)
77
// RUN: %target-swift-frontend %S/generic-struct-in-cxx.swift -D KNOWN_LAYOUT -enable-library-evolution -typecheck -module-name Generics -clang-header-expose-decls=all-public -emit-clang-header-path %t/generics.h
88
// RUN: %FileCheck %s < %t/generics.h
9-
// RUN: %check-generic-interop-cxx-header-in-clang(%t/generics.h -Wno-reserved-identifier)
9+
// RUN: %check-interop-cxx-header-in-clang(%t/generics.h -Wno-reserved-identifier)
1010

1111
// CHECK: // Stub struct to be used to pass/return values to/from Swift functions.
1212
// CHECK-NEXT: struct swift_interop_passStub_Generics_[[PTRPTRENC:void_ptr_[0-9]_[0-9]_void_ptr_[0-9]_[0-9]+]] {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend %S/generic-struct-in-cxx.swift -D KNOWN_LAYOUT -D INDIRECT_KNOWN_LAYOUT -typecheck -module-name Generics -clang-header-expose-decls=all-public -emit-clang-header-path %t/generics.h
33
// RUN: %FileCheck %s < %t/generics.h
4-
// RUN: %check-generic-interop-cxx-header-in-clang(%t/generics.h -Wno-reserved-identifier)
4+
// RUN: %check-interop-cxx-header-in-clang(%t/generics.h -Wno-reserved-identifier)
55

66
// RUN: %empty-directory(%t)
77
// RUN: %target-swift-frontend %S/generic-struct-in-cxx.swift -D KNOWN_LAYOUT -D INDIRECT_KNOWN_LAYOUT -enable-library-evolution -typecheck -module-name Generics -clang-header-expose-decls=all-public -emit-clang-header-path %t/generics.h
88
// RUN: %FileCheck %s < %t/generics.h
9-
// RUN: %check-generic-interop-cxx-header-in-clang(%t/generics.h -Wno-reserved-identifier)
9+
// RUN: %check-interop-cxx-header-in-clang(%t/generics.h -Wno-reserved-identifier)
1010

1111
// CHECK: SWIFT_EXTERN void $s8Generics11GenericPairV1yq_vg(SWIFT_INDIRECT_RESULT void * _Nonnull, void * _Nonnull , SWIFT_CONTEXT const void * _Nonnull _self) SWIFT_NOEXCEPT SWIFT_CALL; // _
1212
// CHECK-NEXT: SWIFT_EXTERN void $s8Generics11GenericPairV1yq_vs(const void * _Nonnull newValue, void * _Nonnull , SWIFT_CONTEXT void * _Nonnull _self) SWIFT_NOEXCEPT SWIFT_CALL; // _

test/Interop/SwiftToCxx/generics/generic-type-traits-fwd.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend %s -typecheck -module-name Generics -enable-experimental-cxx-interop -clang-header-expose-decls=has-expose-attr -emit-clang-header-path %t/generics.h
33
// RUN: %FileCheck %s < %t/generics.h
4-
// RUN: %check-generic-interop-cxx-header-in-clang(%t/generics.h)
4+
// RUN: %check-interop-cxx-header-in-clang(%t/generics.h)
55

66
@_expose(Cxx)
77
public enum ComesFirstEnum {

test/Interop/SwiftToCxx/stdlib/stdlib-dep-inline-in-cxx.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
// RUN: cat %t/stdlib.h %t/stdlib2.h > %t/two_includes.h
99

10-
// RUN: %check-generic-interop-cxx-header-in-clang(%t/two_includes.h -Wno-unused-private-field -Wno-unused-function -Wno-shadow)
10+
// RUN: %check-interop-cxx-header-in-clang(%t/two_includes.h -Wno-unused-private-field -Wno-unused-function -Wno-shadow)
1111

1212
@_expose(Cxx)
1313
public func test() -> String {

test/Interop/SwiftToCxx/stdlib/swift-stdlib-in-cxx.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: %target-swift-frontend -parse-as-library %platform-module-dir/Swift.swiftmodule/%module-target-triple.swiftinterface -enable-library-evolution -disable-objc-attr-requires-foundation-module -typecheck -module-name Swift -parse-stdlib -enable-experimental-cxx-interop -emit-clang-header-path %t/Swift.h -experimental-skip-all-function-bodies
33
// RUN: %FileCheck %s < %t/Swift.h
44

5-
// RUN: %check-generic-interop-cxx-header-in-clang(%t/Swift.h -Wno-unused-private-field -Wno-unused-function -Wno-shadow)
5+
// RUN: %check-interop-cxx-header-in-clang(%t/Swift.h -Wno-unused-private-field -Wno-unused-function -Wno-shadow)
66

77
// FIXME: remove need for -Wno-shadow
88

0 commit comments

Comments
 (0)