mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[cxx-interop] Update fix-its to use new macro naming.
This commit is contained in:
@@ -169,9 +169,9 @@ NOTE(reference_passed_by_value, none, "function uses foreign reference type "
|
||||
"C++ Interop User Manual).",
|
||||
(StringRef, StringRef))
|
||||
NOTE(record_not_automatically_importable, none, "record '%0' is not "
|
||||
"automatically importable: %1. "
|
||||
"Refer to the C++ Interop User "
|
||||
"Manual to classify this type.",
|
||||
"automatically available: %1. "
|
||||
"Does this type have reference "
|
||||
"semantics?",
|
||||
(StringRef, StringRef))
|
||||
|
||||
NOTE(projection_value_not_imported, none, "C++ method '%0' that returns a value "
|
||||
@@ -186,10 +186,10 @@ NOTE(projection_reference_not_imported, none, "C++ method '%0' that returns a re
|
||||
NOTE(projection_may_return_interior_ptr, none, "C++ method '%0' may return an "
|
||||
"interior pointer. ",
|
||||
(StringRef))
|
||||
NOTE(mark_self_contained, none, "Mark type '%0' as 'self_contained' in C++ to "
|
||||
NOTE(mark_self_contained, none, "Mark type '%0' as 'SELF_CONTAINED' in C++ to "
|
||||
"make methods that use it available in Swift. ",
|
||||
(StringRef))
|
||||
NOTE(mark_safe_to_import, none, "Mark method '%0' as 'safe_to_import' in C++ to "
|
||||
NOTE(mark_safe_to_import, none, "Mark method '%0' as 'SAFE_TO_IMPORT' in C++ to "
|
||||
"make it available in Swift. ",
|
||||
(StringRef))
|
||||
|
||||
|
||||
@@ -4036,7 +4036,7 @@ void MissingMemberFailure::diagnoseUnsafeCxxMethod(SourceLoc loc,
|
||||
.diagnose(methodSwiftLoc, diag::mark_safe_to_import,
|
||||
name.getBaseIdentifier().str())
|
||||
.fixItInsert(methodSwiftLoc,
|
||||
" __attribute__((swift_attr(\"safe_to_import\"))) ");
|
||||
" SAFE_TO_IMPORT ");
|
||||
} else if (cxxMethod->getReturnType()->isReferenceType()) {
|
||||
// Rewrite a call to .at(42) as a subscript.
|
||||
if (name.getBaseIdentifier().is("at") &&
|
||||
@@ -4067,7 +4067,7 @@ void MissingMemberFailure::diagnoseUnsafeCxxMethod(SourceLoc loc,
|
||||
.diagnose(methodSwiftLoc, diag::mark_safe_to_import,
|
||||
name.getBaseIdentifier().str())
|
||||
.fixItInsert(methodSwiftLoc,
|
||||
" __attribute__((swift_attr(\"safe_to_import\"))) ");
|
||||
" SAFE_TO_IMPORT ");
|
||||
}
|
||||
} else if (cxxMethod->getReturnType()->isRecordType()) {
|
||||
if (auto cxxRecord = dyn_cast<clang::CXXRecordDecl>(
|
||||
@@ -4089,11 +4089,11 @@ void MissingMemberFailure::diagnoseUnsafeCxxMethod(SourceLoc loc,
|
||||
.diagnose(methodSwiftLoc, diag::mark_safe_to_import,
|
||||
name.getBaseIdentifier().str())
|
||||
.fixItInsert(methodSwiftLoc,
|
||||
" __attribute__((swift_attr(\"safe_to_import\"))) ");
|
||||
" SAFE_TO_IMPORT ");
|
||||
ctx.Diags
|
||||
.diagnose(baseSwiftLoc, diag::mark_self_contained, returnTypeStr)
|
||||
.fixItInsert(baseSwiftLoc,
|
||||
"__attribute__((swift_attr(\"self_contained\"))) ");
|
||||
"SELF_CONTAINED ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,21 +21,21 @@ struct X {
|
||||
import Test
|
||||
|
||||
public func test(x: X) {
|
||||
// CHECK: note: Mark method 'test' as 'safe_to_import' in C++ to make it available in Swift.
|
||||
// CHECK: note: Mark method 'test' as 'SAFE_TO_IMPORT' in C++ to make it available in Swift.
|
||||
// CHECK: int *test() { }
|
||||
// CHECK: ^
|
||||
// CHECK: __attribute__((swift_attr("safe_to_import")))
|
||||
// CHECK: SAFE_TO_IMPORT
|
||||
|
||||
x.test()
|
||||
|
||||
// CHECK: note: Mark method 'other' as 'safe_to_import' in C++ to make it available in Swift.
|
||||
// CHECK: note: Mark method 'other' as 'SAFE_TO_IMPORT' in C++ to make it available in Swift.
|
||||
// CHECK: Ptr other() { }
|
||||
// CHECK: ^
|
||||
// CHECK: __attribute__((swift_attr("safe_to_import")))
|
||||
// CHECK: SAFE_TO_IMPORT
|
||||
|
||||
// CHECK: note: Mark type 'Ptr' as 'self_contained' in C++ to make methods that use it available in Swift.
|
||||
// CHECK: note: Mark type 'Ptr' as 'SELF_CONTAINED' in C++ to make methods that use it available in Swift.
|
||||
// CHECK: struct X {
|
||||
// CHECK: ^
|
||||
// CHECK: __attribute__((swift_attr("self_contained")))
|
||||
// CHECK: SELF_CONTAINED
|
||||
x.other()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user