Skip to content

Commit d47a262

Browse files
committed
[cxx-interop] Clean up diagnostics for functions returning FRTs
- Delete baseline language feature WarnUnannotatedReturnOfCxxFrt, which won't really be useful to users - Remove some references to "cxx", since FRTs are not exclusively imported from C++ - Clean up lit test RUN lines to use %{fs-sep}
1 parent facef0e commit d47a262

File tree

8 files changed

+18
-17
lines changed

8 files changed

+18
-17
lines changed

include/swift/AST/DiagnosticGroups.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ GROUP(AlwaysAvailableDomain, "always-available-domain")
4545
GROUP(AvailabilityUnrecognizedName, "availability-unrecognized-name")
4646
GROUP(ClangDeclarationImport, "clang-declaration-import")
4747
GROUP(ConformanceIsolation, "conformance-isolation")
48-
GROUP(CxxForeignReferenceType, "cxx-foreign-reference-type")
48+
GROUP(ForeignReferenceType, "foreign-reference-type")
4949
GROUP(DeprecatedDeclaration, "deprecated-declaration")
5050
GROUP(DynamicCallable, "dynamic-callable-requirements")
5151
GROUP(EmbeddedRestrictions, "embedded-restrictions")

include/swift/AST/DiagnosticsSema.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2211,7 +2211,7 @@ ERROR(expose_nested_type_to_cxx,none,
22112211
"nested %kind0 can not yet be represented in C++", (ValueDecl *))
22122212
ERROR(expose_macro_to_cxx,none,
22132213
"Swift macro can not yet be represented in C++", (ValueDecl *))
2214-
GROUPED_WARNING(warn_unannotated_cxx_func_returning_frt, CxxForeignReferenceType, none,
2214+
GROUPED_WARNING(warn_unannotated_cxx_func_returning_frt, ForeignReferenceType, none,
22152215
"cannot infer the ownership of the returned value, annotate %0 with "
22162216
"either SWIFT_RETURNS_RETAINED or SWIFT_RETURNS_UNRETAINED",
22172217
(const ValueDecl *))

include/swift/Basic/Features.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ BASELINE_LANGUAGE_FEATURE(BuiltinUnprotectedStackAlloc, 0, "Builtin.unprotectedS
213213
BASELINE_LANGUAGE_FEATURE(BuiltinTaskRunInline, 0, "Builtin.taskRunInline")
214214
BASELINE_LANGUAGE_FEATURE(BuiltinUnprotectedAddressOf, 0, "Builtin.unprotectedAddressOf")
215215
BASELINE_LANGUAGE_FEATURE(NewCxxMethodSafetyHeuristics, 0, "Only import C++ methods that return pointers (projections) on owned types as unsafe")
216-
BASELINE_LANGUAGE_FEATURE(WarnUnannotatedReturnOfCxxFrt, 0, "Warn about unannotated C++ functions returning foreign reference types")
217216
BASELINE_LANGUAGE_FEATURE(SpecializeAttributeWithAvailability, 0, "@_specialize attribute with availability")
218217
BASELINE_LANGUAGE_FEATURE(BuiltinAssumeAlignment, 0, "Builtin.assumeAlignment")
219218
BASELINE_LANGUAGE_FEATURE(BuiltinCreateTaskGroupWithFlags, 0, "Builtin.createTaskGroupWithFlags")

test/Interop/Cxx/foreign-reference/frt-reference-returns-diagnostics.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// RUN: rm -rf %t
2-
// RUN: %target-typecheck-verify-swift -I %S%{fs-sep}Inputs -cxx-interoperability-mode=default -verify-additional-file %S%{fs-sep}Inputs%{fs-sep}frt-reference-returns.h
1+
// RUN: %target-typecheck-verify-swift -cxx-interoperability-mode=default \
2+
// RUN: -I %S%{fs-sep}Inputs \
3+
// RUN: -verify-additional-file %S%{fs-sep}Inputs%{fs-sep}frt-reference-returns.h
34

45
import FRTReferenceReturns
56

test/Interop/Cxx/foreign-reference/frt-retained-unretained-attributes-error.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
// RUN: rm -rf %t
2-
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs %s -cxx-interoperability-mode=upcoming-swift -verify-additional-file %S/Inputs/cxx-functions-and-methods-returning-frt.h -Xcc -Wno-return-type -Xcc -Wno-nullability-completeness
3-
4-
// XFAIL: OS=windows-msvc
5-
// TODO: Enable this on windows when -verify-additional-file issue on Windows Swift CI is resolved
6-
1+
// RUN: %target-swift-frontend -typecheck -verify -cxx-interoperability-mode=default \
2+
// RUN: -Xcc -Wno-return-type -Xcc -Wno-nullability-completeness \
3+
// RUN: -I %S%{fs-sep}Inputs %s \
4+
// RUN: -verify-additional-file %S%{fs-sep}Inputs%{fs-sep}cxx-functions-and-methods-returning-frt.h
75

86
import FunctionsAndMethodsReturningFRT
97
import CxxStdlib

test/Interop/Cxx/foreign-reference/inheritance-diagnostics.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
// RUN: rm -rf %t
2-
// RUN: %target-swift-frontend -typecheck -verify -I %S%{fs-sep}Inputs %s -cxx-interoperability-mode=upcoming-swift -verify-additional-file %S%{fs-sep}Inputs%{fs-sep}inheritance.h -Xcc -Wno-return-type -Xcc -Wno-inaccessible-base
3-
1+
// RUN: %target-swift-frontend -typecheck -verify -cxx-interoperability-mode=default \
2+
// RUN: -Xcc -Wno-return-type -Xcc -Wno-inaccessible-base \
3+
// RUN: -I %S%{fs-sep}Inputs %s \
4+
// RUN: -verify-additional-file %S%{fs-sep}Inputs%{fs-sep}inheritance.h
45

56
import Inheritance
67

test/Interop/Cxx/objc-correctness/objc-returning-cxx-frt-diagnostics.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
// RUN: rm -rf %t
2-
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs %s -cxx-interoperability-mode=upcoming-swift -verify-additional-file %S/Inputs/cxx-frt.h -Xcc -Wno-return-type
1+
// RUN: %target-swift-frontend -typecheck -verify -cxx-interoperability-mode=default \
2+
// RUN: -Xcc -Wno-return-type \
3+
// RUN: -I %S/Inputs %s \
4+
// RUN: -verify-additional-file %S/Inputs/cxx-frt.h
35

6+
// REQUIRES: objc_interop
47

58
import CxxForeignRef
69

7-
// REQUIRES: objc_interop
810
func testObjCMethods() {
911
_ = Bridge.objCMethodReturningFRTBothAnnotations()
1012
_ = Bridge.objCMethodReturningNonCxxFrtAnannotated()
File renamed without changes.

0 commit comments

Comments
 (0)