Skip to content

Commit 048e5c7

Browse files
committed
[cxx-interop] Update fix-its to use new macro naming.
1 parent ba8e00d commit 048e5c7

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

include/swift/AST/DiagnosticsClangImporter.def

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ NOTE(reference_passed_by_value, none, "function uses foreign reference type "
169169
"C++ Interop User Manual).",
170170
(StringRef, StringRef))
171171
NOTE(record_not_automatically_importable, none, "record '%0' is not "
172-
"automatically importable: %1. "
173-
"Refer to the C++ Interop User "
174-
"Manual to classify this type.",
172+
"automatically available: %1. "
173+
"Does this type have reference "
174+
"semantics?",
175175
(StringRef, StringRef))
176176

177177
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
186186
NOTE(projection_may_return_interior_ptr, none, "C++ method '%0' may return an "
187187
"interior pointer. ",
188188
(StringRef))
189-
NOTE(mark_self_contained, none, "Mark type '%0' as 'self_contained' in C++ to "
189+
NOTE(mark_self_contained, none, "Mark type '%0' as 'SELF_CONTAINED' in C++ to "
190190
"make methods that use it available in Swift. ",
191191
(StringRef))
192-
NOTE(mark_safe_to_import, none, "Mark method '%0' as 'safe_to_import' in C++ to "
192+
NOTE(mark_safe_to_import, none, "Mark method '%0' as 'SAFE_TO_IMPORT' in C++ to "
193193
"make it available in Swift. ",
194194
(StringRef))
195195

lib/Sema/CSDiagnostics.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4036,7 +4036,7 @@ void MissingMemberFailure::diagnoseUnsafeCxxMethod(SourceLoc loc,
40364036
.diagnose(methodSwiftLoc, diag::mark_safe_to_import,
40374037
name.getBaseIdentifier().str())
40384038
.fixItInsert(methodSwiftLoc,
4039-
" __attribute__((swift_attr(\"safe_to_import\"))) ");
4039+
" SAFE_TO_IMPORT ");
40404040
} else if (cxxMethod->getReturnType()->isReferenceType()) {
40414041
// Rewrite a call to .at(42) as a subscript.
40424042
if (name.getBaseIdentifier().is("at") &&
@@ -4067,7 +4067,7 @@ void MissingMemberFailure::diagnoseUnsafeCxxMethod(SourceLoc loc,
40674067
.diagnose(methodSwiftLoc, diag::mark_safe_to_import,
40684068
name.getBaseIdentifier().str())
40694069
.fixItInsert(methodSwiftLoc,
4070-
" __attribute__((swift_attr(\"safe_to_import\"))) ");
4070+
" SAFE_TO_IMPORT ");
40714071
}
40724072
} else if (cxxMethod->getReturnType()->isRecordType()) {
40734073
if (auto cxxRecord = dyn_cast<clang::CXXRecordDecl>(
@@ -4089,11 +4089,11 @@ void MissingMemberFailure::diagnoseUnsafeCxxMethod(SourceLoc loc,
40894089
.diagnose(methodSwiftLoc, diag::mark_safe_to_import,
40904090
name.getBaseIdentifier().str())
40914091
.fixItInsert(methodSwiftLoc,
4092-
" __attribute__((swift_attr(\"safe_to_import\"))) ");
4092+
" SAFE_TO_IMPORT ");
40934093
ctx.Diags
40944094
.diagnose(baseSwiftLoc, diag::mark_self_contained, returnTypeStr)
40954095
.fixItInsert(baseSwiftLoc,
4096-
"__attribute__((swift_attr(\"self_contained\"))) ");
4096+
"SELF_CONTAINED ");
40974097
}
40984098
}
40994099
}

test/Interop/Cxx/class/fixit-add-safe-to-import-self-contained.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,21 @@ struct X {
2121
import Test
2222

2323
public func test(x: X) {
24-
// CHECK: note: Mark method 'test' as 'safe_to_import' in C++ to make it available in Swift.
24+
// CHECK: note: Mark method 'test' as 'SAFE_TO_IMPORT' in C++ to make it available in Swift.
2525
// CHECK: int *test() { }
2626
// CHECK: ^
27-
// CHECK: __attribute__((swift_attr("safe_to_import")))
27+
// CHECK: SAFE_TO_IMPORT
2828

2929
x.test()
3030

31-
// CHECK: note: Mark method 'other' as 'safe_to_import' in C++ to make it available in Swift.
31+
// CHECK: note: Mark method 'other' as 'SAFE_TO_IMPORT' in C++ to make it available in Swift.
3232
// CHECK: Ptr other() { }
3333
// CHECK: ^
34-
// CHECK: __attribute__((swift_attr("safe_to_import")))
34+
// CHECK: SAFE_TO_IMPORT
3535

36-
// CHECK: note: Mark type 'Ptr' as 'self_contained' in C++ to make methods that use it available in Swift.
36+
// CHECK: note: Mark type 'Ptr' as 'SELF_CONTAINED' in C++ to make methods that use it available in Swift.
3737
// CHECK: struct X {
3838
// CHECK: ^
39-
// CHECK: __attribute__((swift_attr("self_contained")))
39+
// CHECK: SELF_CONTAINED
4040
x.other()
4141
}

0 commit comments

Comments
 (0)