Skip to content

Commit 8f7af45

Browse files
authored
[cxx-interop] fix a typo in returns_retained_or_returns_unretained_for_non_cxx_frt_values (#84481)
[PR-84375](#84375) mistakenly added a typo to the message of the `returns_retained_or_returns_unretained_for_non_cxx_frt_values` diagnostic just before merging. Fixing that typo in this patch.
1 parent 275deaf commit 8f7af45

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

include/swift/AST/DiagnosticsClangImporter.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ ERROR(redundant_conformance_protocol,none,
303303
"redundant conformance of %0 to protocol '%1'", (Type, StringRef))
304304

305305
WARNING(returns_retained_or_returns_unretained_for_non_cxx_frt_values, none,
306-
"%0 should not be annotated with SWIFT_TURNS_RETAINED or "
306+
"%0 should not be annotated with SWIFT_RETURNS_RETAINED or "
307307
"SWIFT_RETURNS_UNRETAINED because it is not returning "
308308
"a SWIFT_SHARED_REFERENCE type",
309309
(const clang::NamedDecl *))

test/Interop/Cxx/foreign-reference/Inputs/cxx-functions-and-methods-returning-frt.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,38 +191,38 @@ FRTStruct *_Nonnull global_function_returning_cxx_frt_with_annotations()
191191
// C++ APIs returning non-cxx-frts (for testing diagnostics)
192192
struct StructWithAPIsReturningNonCxxFrt {
193193
static NonFRTStruct *_Nonnull StaticMethodReturningNonCxxFrt();
194-
static NonFRTStruct *_Nonnull StaticMethodReturningNonCxxFrtWithAnnotation() // expected-warning {{'StaticMethodReturningNonCxxFrtWithAnnotation' should not be annotated with SWIFT_TURNS_RETAINED or SWIFT_RETURNS_UNRETAINED because it is not returning a SWIFT_SHARED_REFERENCE type}}
194+
static NonFRTStruct *_Nonnull StaticMethodReturningNonCxxFrtWithAnnotation() // expected-warning {{'StaticMethodReturningNonCxxFrtWithAnnotation' should not be annotated with SWIFT_RETURNS_RETAINED or SWIFT_RETURNS_UNRETAINED because it is not returning a SWIFT_SHARED_REFERENCE type}}
195195
__attribute__((swift_attr("returns_retained")));
196196
};
197197

198198
NonFRTStruct *_Nonnull global_function_returning_non_cxx_frt();
199-
NonFRTStruct *_Nonnull global_function_returning_non_cxx_frt_with_annotations() // expected-warning {{'global_function_returning_non_cxx_frt_with_annotations' should not be annotated with SWIFT_TURNS_RETAINED or SWIFT_RETURNS_UNRETAINED because it is not returning a SWIFT_SHARED_REFERENCE type}}
199+
NonFRTStruct *_Nonnull global_function_returning_non_cxx_frt_with_annotations() // expected-warning {{'global_function_returning_non_cxx_frt_with_annotations' should not be annotated with SWIFT_RETURNS_RETAINED or SWIFT_RETURNS_UNRETAINED because it is not returning a SWIFT_SHARED_REFERENCE type}}
200200
__attribute__((swift_attr("returns_retained")));
201201

202202
// C++ APIs returning SWIFT_IMMORTAL_REFERENCE types (for testing diagnostics)
203203
struct StructWithAPIsReturningImmortalReference {
204204
static ImmortalRefStruct *_Nonnull StaticMethodReturningImmortalReference();
205205
static ImmortalRefStruct
206-
*_Nonnull StaticMethodReturningImmortalReferenceWithAnnotation() // expected-warning {{'StaticMethodReturningImmortalReferenceWithAnnotation' should not be annotated with SWIFT_TURNS_RETAINED or SWIFT_RETURNS_UNRETAINED because it is not returning a SWIFT_SHARED_REFERENCE type}}
206+
*_Nonnull StaticMethodReturningImmortalReferenceWithAnnotation() // expected-warning {{'StaticMethodReturningImmortalReferenceWithAnnotation' should not be annotated with SWIFT_RETURNS_RETAINED or SWIFT_RETURNS_UNRETAINED because it is not returning a SWIFT_SHARED_REFERENCE type}}
207207
__attribute__((swift_attr("returns_retained")));
208208
};
209209

210210
ImmortalRefStruct *_Nonnull global_function_returning_immortal_reference();
211211
ImmortalRefStruct
212-
*_Nonnull global_function_returning_immortal_reference_with_annotations() // expected-warning {{'global_function_returning_immortal_reference_with_annotations' should not be annotated with SWIFT_TURNS_RETAINED or SWIFT_RETURNS_UNRETAINED because it is not returning a SWIFT_SHARED_REFERENCE type}}
212+
*_Nonnull global_function_returning_immortal_reference_with_annotations() // expected-warning {{'global_function_returning_immortal_reference_with_annotations' should not be annotated with SWIFT_RETURNS_RETAINED or SWIFT_RETURNS_UNRETAINED because it is not returning a SWIFT_SHARED_REFERENCE type}}
213213
__attribute__((swift_attr("returns_retained")));
214214

215215
// C++ APIs returning SWIFT_UNSAFE_REFERENCE types (for testing diagnostics)
216216
struct StructWithAPIsReturningUnsafeReference {
217217
static UnsafeRefStruct *_Nonnull StaticMethodReturningUnsafeReference();
218218
static UnsafeRefStruct
219-
*_Nonnull StaticMethodReturningUnsafeReferenceWithAnnotation() // expected-warning {{'StaticMethodReturningUnsafeReferenceWithAnnotation' should not be annotated with SWIFT_TURNS_RETAINED or SWIFT_RETURNS_UNRETAINED because it is not returning a SWIFT_SHARED_REFERENCE type}}
219+
*_Nonnull StaticMethodReturningUnsafeReferenceWithAnnotation() // expected-warning {{'StaticMethodReturningUnsafeReferenceWithAnnotation' should not be annotated with SWIFT_RETURNS_RETAINED or SWIFT_RETURNS_UNRETAINED because it is not returning a SWIFT_SHARED_REFERENCE type}}
220220
__attribute__((swift_attr("returns_retained")));
221221
};
222222

223223
UnsafeRefStruct *_Nonnull global_function_returning_unsafe_reference();
224224
UnsafeRefStruct
225-
*_Nonnull global_function_returning_unsafe_reference_with_annotations() // expected-warning {{'global_function_returning_unsafe_reference_with_annotations' should not be annotated with SWIFT_TURNS_RETAINED or SWIFT_RETURNS_UNRETAINED because it is not returning a SWIFT_SHARED_REFERENCE type}}
225+
*_Nonnull global_function_returning_unsafe_reference_with_annotations() // expected-warning {{'global_function_returning_unsafe_reference_with_annotations' should not be annotated with SWIFT_RETURNS_RETAINED or SWIFT_RETURNS_UNRETAINED because it is not returning a SWIFT_SHARED_REFERENCE type}}
226226
__attribute__((swift_attr("returns_retained")));
227227

228228
// Global/free C++ functions returning non-FRT

test/Interop/Cxx/objc-correctness/Inputs/cxx-frt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void releaseCxxRefType(CxxRefType *_Nonnull b) {}
2424
+ (struct CxxRefType *)objCMethodReturningFRTBothAnnotations // expected-error {{'objCMethodReturningFRTBothAnnotations' cannot be annotated with both SWIFT_RETURNS_RETAINED and SWIFT_RETURNS_UNRETAINED}}
2525
__attribute__((swift_attr("returns_unretained")))
2626
__attribute__((swift_attr("returns_retained")));
27-
+ (struct CxxValType *)objCMethodReturningNonCxxFrtAnannotated // expected-warning {{'objCMethodReturningNonCxxFrtAnannotated' should not be annotated with SWIFT_TURNS_RETAINED or SWIFT_RETURNS_UNRETAINED because it is not returning a SWIFT_SHARED_REFERENCE type}}
27+
+ (struct CxxValType *)objCMethodReturningNonCxxFrtAnannotated // expected-warning {{'objCMethodReturningNonCxxFrtAnannotated' should not be annotated with SWIFT_RETURNS_RETAINED or SWIFT_RETURNS_UNRETAINED because it is not returning a SWIFT_SHARED_REFERENCE type}}
2828
__attribute__((swift_attr("returns_retained")));
2929

3030
@end

0 commit comments

Comments
 (0)