Skip to content

Commit 79eaf77

Browse files
committed
Weaken access note warnings into remarks
1 parent 276393f commit 79eaf77

File tree

2 files changed

+35
-36
lines changed

2 files changed

+35
-36
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5648,32 +5648,31 @@ ERROR(atomics_ordering_must_be_constant, none,
56485648
// MARK: access notes
56495649
//------------------------------------------------------------------------------
56505650

5651-
WARNING(attr_added_by_access_note, none,
5652-
"access note for %0 adds %select{attribute|modifier}1 '%2' to "
5653-
"this %3",
5654-
(StringRef, bool, StringRef, DescriptiveDeclKind))
5651+
REMARK(attr_added_by_access_note, none,
5652+
"access note for %0 adds %select{attribute|modifier}1 '%2' to this %3",
5653+
(StringRef, bool, StringRef, DescriptiveDeclKind))
56555654
NOTE(fixit_attr_added_by_access_note, none,
56565655
"add %select{attribute|modifier}0 explicitly to silence this warning",
56575656
(bool))
56585657

5659-
WARNING(attr_removed_by_access_note, none,
5660-
"access note for %0 removes %select{attribute|modifier}1 '%2' from "
5661-
"this %3",
5662-
(StringRef, bool, StringRef, DescriptiveDeclKind))
5658+
REMARK(attr_removed_by_access_note, none,
5659+
"access note for %0 removes %select{attribute|modifier}1 '%2' from "
5660+
"this %3",
5661+
(StringRef, bool, StringRef, DescriptiveDeclKind))
56635662
NOTE(fixit_attr_removed_by_access_note, none,
56645663
"remove %select{attribute|modifier}0 explicitly to silence this warning",
56655664
(bool))
56665665

5667-
WARNING(attr_objc_name_changed_by_access_note, none,
5666+
REMARK(attr_objc_name_changed_by_access_note, none,
56685667
"access note for %0 changes the '@objc' name of this %1 to %2",
56695668
(StringRef, DescriptiveDeclKind, ObjCSelector))
5670-
WARNING(fixit_attr_objc_name_changed_by_access_note, none,
5671-
"change '@objc' name in source code explicitly to silence this warning",
5672-
())
5673-
WARNING(attr_objc_name_conflicts_with_access_note, none,
5674-
"access note for %0 changes the '@objc' name of this %1 to %2, but "
5675-
"source code specifies %3; the access note will be ignored",
5676-
(StringRef, DescriptiveDeclKind, ObjCSelector, ObjCSelector))
5669+
NOTE(fixit_attr_objc_name_changed_by_access_note, none,
5670+
"change '@objc' name in source code explicitly to silence this warning",
5671+
())
5672+
REMARK(attr_objc_name_conflicts_with_access_note, none,
5673+
"access note for %0 changes the '@objc' name of this %1 to %2, but "
5674+
"source code specifies %3; the access note will be ignored",
5675+
(StringRef, DescriptiveDeclKind, ObjCSelector, ObjCSelector))
56775676

56785677
#define UNDEFINE_DIAGNOSTIC_MACROS
56795678
#include "DefineDiagnosticMacros.h"

test/SILGen/objc_access_notes.swift

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import gizmo
1010
import ansible
1111

1212
class Hoozit : Gizmo {
13-
// expected-warning@+2 {{access note for fancy test suite adds attribute 'objc' to this instance method}}
13+
// expected-remark@+2 {{access note for fancy test suite adds attribute 'objc' to this instance method}}
1414
// expected-note@+1 {{add attribute explicitly to silence this warning}} {{3-3=@objc }}
1515
func typical(_ x: Int, y: Gizmo) -> Gizmo { return y }
1616
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s11objc_thunks6HoozitC7typical_1ySo5GizmoCSi_AGtFTo : $@convention(objc_method) (Int, Gizmo, Hoozit) -> @autoreleased Gizmo {
@@ -56,7 +56,7 @@ class Hoozit : Gizmo {
5656
// CHECK-NEXT: }
5757

5858
// NS_RETURNS_RETAINED by family (-copy)
59-
// expected-warning@+2 {{access note for fancy test suite adds attribute 'objc' to this instance method}}
59+
// expected-remark@+2 {{access note for fancy test suite adds attribute 'objc' to this instance method}}
6060
// expected-note@+1 {{add attribute explicitly to silence this warning}} {{3-3=@objc }}
6161
func copyFoo() -> Gizmo { return self }
6262
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s11objc_thunks6HoozitC7copyFooSo5GizmoCyFTo : $@convention(objc_method) (Hoozit) -> @owned Gizmo
@@ -72,7 +72,7 @@ class Hoozit : Gizmo {
7272
// CHECK-NEXT: }
7373

7474
// NS_RETURNS_RETAINED by family (-mutableCopy)
75-
// expected-warning@+2 {{access note for fancy test suite adds attribute 'objc' to this instance method}}
75+
// expected-remark@+2 {{access note for fancy test suite adds attribute 'objc' to this instance method}}
7676
// expected-note@+1 {{add attribute explicitly to silence this warning}} {{3-3=@objc }}
7777
func mutableCopyFoo() -> Gizmo { return self }
7878
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s11objc_thunks6HoozitC14mutableCopyFooSo5GizmoCyFTo : $@convention(objc_method) (Hoozit) -> @owned Gizmo
@@ -90,7 +90,7 @@ class Hoozit : Gizmo {
9090
// NS_RETURNS_RETAINED by family (-copy). This is different from Swift's
9191
// normal notion of CamelCase, but it's what Clang does, so we should match
9292
// it.
93-
// expected-warning@+2 {{access note for fancy test suite adds attribute 'objc' to this instance method}}
93+
// expected-remark@+2 {{access note for fancy test suite adds attribute 'objc' to this instance method}}
9494
// expected-note@+1 {{add attribute explicitly to silence this warning}} {{3-3=@objc }}
9595
func copy8() -> Gizmo { return self }
9696
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s11objc_thunks6HoozitC5copy8So5GizmoCyFTo : $@convention(objc_method) (Hoozit) -> @owned Gizmo
@@ -106,7 +106,7 @@ class Hoozit : Gizmo {
106106
// CHECK-NEXT: }
107107

108108
// NS_RETURNS_RETAINED by family (-copy)
109-
// expected-warning@+2 {{access note for fancy test suite adds attribute 'objc' to this instance method}}
109+
// expected-remark@+2 {{access note for fancy test suite adds attribute 'objc' to this instance method}}
110110
// expected-note@+1 {{add attribute explicitly to silence this warning}} {{3-3=@objc(copyDuplicate) }}
111111
func makeDuplicate() -> Gizmo { return self }
112112
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s11objc_thunks6HoozitC13makeDuplicateSo5GizmoCyFTo : $@convention(objc_method) (Hoozit) -> @owned Gizmo
@@ -123,7 +123,7 @@ class Hoozit : Gizmo {
123123

124124
// Override the normal family conventions to make this non-consuming and
125125
// returning at +0.
126-
// expected-warning@+2 {{access note for fancy test suite adds attribute 'objc' to this instance method}}
126+
// expected-remark@+2 {{access note for fancy test suite adds attribute 'objc' to this instance method}}
127127
// expected-note@+1 {{add attribute explicitly to silence this warning}} {{3-3=@objc }}
128128
func initFoo() -> Gizmo { return self }
129129
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s11objc_thunks6HoozitC7initFooSo5GizmoCyFTo : $@convention(objc_method) (Hoozit) -> @autoreleased Gizmo
@@ -138,7 +138,7 @@ class Hoozit : Gizmo {
138138
// CHECK-NEXT: return [[RES]]
139139
// CHECK-NEXT: }
140140

141-
// expected-warning@+2 {{access note for fancy test suite adds attribute 'objc' to this property}}
141+
// expected-remark@+2 {{access note for fancy test suite adds attribute 'objc' to this property}}
142142
// expected-note@+1 {{add attribute explicitly to silence this warning}} {{3-3=@objc }}
143143
var typicalProperty: Gizmo
144144
// -- getter
@@ -190,7 +190,7 @@ class Hoozit : Gizmo {
190190
// CHECK: } // end sil function '$s11objc_thunks6HoozitC15typicalPropertySo5GizmoCvs'
191191

192192
// NS_RETURNS_RETAINED getter by family (-copy)
193-
// expected-warning@+2 {{access note for fancy test suite adds attribute 'objc' to this property}}
193+
// expected-remark@+2 {{access note for fancy test suite adds attribute 'objc' to this property}}
194194
// expected-note@+1 {{add attribute explicitly to silence this warning}} {{3-3=@objc }}
195195
var copyProperty: Gizmo
196196
// -- getter
@@ -239,7 +239,7 @@ class Hoozit : Gizmo {
239239
// CHECK: destroy_value [[ARG1]]
240240
// CHECK: } // end sil function '$s11objc_thunks6HoozitC12copyPropertySo5GizmoCvs'
241241

242-
// expected-warning@+2 {{access note for fancy test suite adds attribute 'objc' to this property}}
242+
// expected-remark@+2 {{access note for fancy test suite adds attribute 'objc' to this property}}
243243
// expected-note@+1 {{add attribute explicitly to silence this warning}} {{3-3=@objc }}
244244
var roProperty: Gizmo { return self }
245245
// -- getter
@@ -258,7 +258,7 @@ class Hoozit : Gizmo {
258258
// -- no setter
259259
// CHECK-NOT: sil hidden [thunk] [ossa] @$s11objc_thunks6HoozitC10roPropertySo5GizmoCvsTo
260260

261-
// expected-warning@+2 {{access note for fancy test suite adds attribute 'objc' to this property}}
261+
// expected-remark@+2 {{access note for fancy test suite adds attribute 'objc' to this property}}
262262
// expected-note@+1 {{add attribute explicitly to silence this warning}} {{3-3=@objc }}
263263
var rwProperty: Gizmo {
264264
get {
@@ -283,7 +283,7 @@ class Hoozit : Gizmo {
283283
// CHECK-NEXT: return
284284
// CHECK-NEXT: }
285285

286-
// expected-warning@+2 {{access note for fancy test suite adds attribute 'objc' to this property}}
286+
// expected-remark@+2 {{access note for fancy test suite adds attribute 'objc' to this property}}
287287
// expected-note@+1 {{add attribute explicitly to silence this warning}} {{3-3=@objc }}
288288
var copyRWProperty: Gizmo {
289289
get {
@@ -319,7 +319,7 @@ class Hoozit : Gizmo {
319319
// CHECK-NEXT: return
320320
// CHECK-NEXT: }
321321

322-
// expected-warning@+2 {{access note for fancy test suite adds attribute 'objc' to this property}}
322+
// expected-remark@+2 {{access note for fancy test suite adds attribute 'objc' to this property}}
323323
// expected-note@+1 {{add attribute explicitly to silence this warning}} {{3-3=@objc }}
324324
var initProperty: Gizmo
325325
// -- getter
@@ -349,13 +349,13 @@ class Hoozit : Gizmo {
349349
// CHECK-NEXT: return
350350
// CHECK-NEXT: }
351351

352-
// expected-warning@+2 {{access note for fancy test suite adds attribute 'objc' to this property}}
352+
// expected-remark@+2 {{access note for fancy test suite adds attribute 'objc' to this property}}
353353
// expected-note@+1 {{add attribute explicitly to silence this warning}} {{3-3=@objc }}
354354
var propComputed: Gizmo {
355-
// expected-warning@+2 {{access note for fancy test suite adds attribute 'objc' to this getter}}
355+
// expected-remark@+2 {{access note for fancy test suite adds attribute 'objc' to this getter}}
356356
// expected-note@+1 {{add attribute explicitly to silence this warning}} {{5-5=@objc(initPropComputedGetter) }}
357357
get { return self }
358-
// expected-warning@+2 {{access note for fancy test suite adds attribute 'objc' to this setter}}
358+
// expected-remark@+2 {{access note for fancy test suite adds attribute 'objc' to this setter}}
359359
// expected-note@+1 {{add attribute explicitly to silence this warning}} {{5-5=@objc(initPropComputedSetter:) }}
360360
set {}
361361
}
@@ -410,7 +410,7 @@ class Hoozit : Gizmo {
410410
}
411411

412412
// Subscript
413-
// expected-warning@+2 {{access note for fancy test suite adds attribute 'objc' to this subscript}}
413+
// expected-remark@+2 {{access note for fancy test suite adds attribute 'objc' to this subscript}}
414414
// expected-note@+1 {{add attribute explicitly to silence this warning}} {{3-3=@objc }}
415415
subscript (i: Int) -> Hoozit {
416416
// Getter
@@ -458,7 +458,7 @@ class Wotsit<T> : Gizmo {
458458
// CHECK-NEXT: }
459459
@objc(plain)
460460
func plain() { }
461-
// expected-warning@-2 {{access note for fancy test suite changes the '@objc' name of this instance method to 'fancy', but source code specifies 'plain'; the access note will be ignored}}
461+
// expected-remark@-2 {{access note for fancy test suite changes the '@objc' name of this instance method to 'fancy', but source code specifies 'plain'; the access note will be ignored}}
462462

463463
func generic<U>(_ x: U) {}
464464

@@ -505,9 +505,9 @@ class Wotsit<T> : Gizmo {
505505
extension Hoozit {
506506
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s11objc_thunks6HoozitC3intACSi_tcfcTo : $@convention(objc_method) (Int, @owned Hoozit) -> @owned Hoozit
507507
convenience init(int i: Int) { self.init(bellsOn: i) }
508-
// expected-warning@-1 {{access note for fancy test suite adds attribute 'objc' to this initializer}}
508+
// expected-remark@-1 {{access note for fancy test suite adds attribute 'objc' to this initializer}}
509509
// expected-note@-2 {{add attribute explicitly to silence this warning}} {{3-3=@objc }}
510-
// expected-warning@-3 {{access note for fancy test suite adds modifier 'dynamic' to this initializer}}
510+
// expected-remark@-3 {{access note for fancy test suite adds modifier 'dynamic' to this initializer}}
511511
// expected-note@-4 {{add modifier explicitly to silence this warning}} {{3-3=dynamic }}
512512

513513
// CHECK-LABEL: sil hidden [ossa] @$s11objc_thunks6HoozitC6doubleACSd_tcfC : $@convention(method) (Double, @thick Hoozit.Type) -> @owned Hoozit
@@ -517,7 +517,7 @@ extension Hoozit {
517517
other()
518518
}
519519

520-
// expected-warning@+2 {{access note for fancy test suite adds attribute 'objc' to this instance method}}
520+
// expected-remark@+2 {{access note for fancy test suite adds attribute 'objc' to this instance method}}
521521
// expected-note@+1 {{add attribute explicitly to silence this warning}} {{3-3=@objc }}
522522
func foof() {}
523523
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s11objc_thunks6HoozitC4foofyyFTo : $@convention(objc_method) (Hoozit) -> () {

0 commit comments

Comments
 (0)