diff options
author | Erik Pilkington <erik.pilkington@gmail.com> | 2019-01-14 19:17:31 +0000 |
---|---|---|
committer | Erik Pilkington <erik.pilkington@gmail.com> | 2019-01-14 19:17:31 +0000 |
commit | 0535b0f387317cc3a7c0ad75a04774efb8fce3be (patch) | |
tree | 40cc109916403ca29dcd18b9a0ad8e38e1b3712a /clang/test/SemaObjC | |
parent | 0e0ccaf7d5df6884df0317715d56b3486483f74a (diff) | |
download | bcm5719-llvm-0535b0f387317cc3a7c0ad75a04774efb8fce3be.tar.gz bcm5719-llvm-0535b0f387317cc3a7c0ad75a04774efb8fce3be.zip |
Improve a -Wunguarded-availability note
Mention the deployment target, and don't say "partial" which doesn't
really mean anything to users.
rdar://problem/33601513
Differential revision: https://reviews.llvm.org/D56523
llvm-svn: 351108
Diffstat (limited to 'clang/test/SemaObjC')
-rw-r--r-- | clang/test/SemaObjC/attr-availability.m | 18 | ||||
-rw-r--r-- | clang/test/SemaObjC/property-deprecated-warning.m | 11 | ||||
-rw-r--r-- | clang/test/SemaObjC/unguarded-availability-new.m | 8 | ||||
-rw-r--r-- | clang/test/SemaObjC/unguarded-availability.m | 36 |
4 files changed, 37 insertions, 36 deletions
diff --git a/clang/test/SemaObjC/attr-availability.m b/clang/test/SemaObjC/attr-availability.m index da1a664e912..eb25175c5a4 100644 --- a/clang/test/SemaObjC/attr-availability.m +++ b/clang/test/SemaObjC/attr-availability.m @@ -5,7 +5,7 @@ - (void)proto_method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2))); // expected-note 2 {{'proto_method' has been explicitly marked deprecated here}} #if defined(WARN_PARTIAL) - // expected-note@+2 2 {{'partial_proto_method' has been explicitly marked partial here}} +// expected-note@+2 2 {{'partial_proto_method' has been marked as being introduced in macOS 10.8 here, but the deployment target is macOS 10.5.0}} #endif - (void)partial_proto_method __attribute__((availability(macosx,introduced=10.8))); @end @@ -13,7 +13,7 @@ @interface A <P> - (void)method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2))); // expected-note {{'method' has been explicitly marked deprecated here}} #if defined(WARN_PARTIAL) - // expected-note@+2 2 {{'partialMethod' has been explicitly marked partial here}} +// expected-note@+2 2 {{'partialMethod' has been marked as being introduced in macOS 10.8 here, but the deployment target is macOS 10.5.0}} #endif - (void)partialMethod __attribute__((availability(macosx,introduced=10.8))); @@ -137,8 +137,8 @@ id NSNibOwner, topNibObjects; @interface PartialI <PartialProt> #ifdef WARN_PARTIAL -// expected-note@+3{{marked partial here}} -// expected-note@+3{{marked partial here}} +// expected-note@+3{{'partialMethod' has been marked as being introduced in macOS 10.8 here, but the deployment target is macOS 10.5.0}} +// expected-note@+3{{'partialMethod' has been marked as being introduced in macOS 10.8 here, but the deployment target is macOS 10.5.0}} #endif - (void)partialMethod __attribute__((availability(macosx,introduced=10.8))); + (void)partialMethod __attribute__((availability(macosx,introduced=10.8))); @@ -147,12 +147,12 @@ id NSNibOwner, topNibObjects; @interface PartialI () - (void)ipartialMethod1 __attribute__((availability(macosx,introduced=10.8))); #if defined(WARN_PARTIAL) - // expected-note@+2 {{'ipartialMethod2' has been explicitly marked partial here}} +// expected-note@+2 {{'ipartialMethod2' has been marked as being introduced in macOS 10.8 here, but the deployment target is macOS 10.5.0}} #endif - (void)ipartialMethod2 __attribute__((availability(macosx,introduced=10.8))); + (void)ipartialMethod1 __attribute__((availability(macosx,introduced=10.8))); #if defined(WARN_PARTIAL) - // expected-note@+2 {{'ipartialMethod2' has been explicitly marked partial here}} +// expected-note@+2 {{'ipartialMethod2' has been marked as being introduced in macOS 10.8 here, but the deployment target is macOS 10.5.0}} #endif + (void)ipartialMethod2 __attribute__((availability(macosx,introduced=10.8))); @end @@ -190,7 +190,7 @@ void partialfun(PartialI* a) { } #if defined(WARN_PARTIAL) - // expected-note@+2 2 {{'PartialI2' has been explicitly marked partial here}} +// expected-note@+2 2 {{'PartialI2' has been marked as being introduced in macOS 10.8 here, but the deployment target is macOS 10.5.0}} #endif __attribute__((availability(macosx, introduced = 10.8))) @interface PartialI2 @end @@ -314,8 +314,8 @@ __attribute__((objc_root_class)) #if defined(WARN_PARTIAL) int fn_10_5() __attribute__((availability(macosx, introduced=10.5))); -int fn_10_7() __attribute__((availability(macosx, introduced=10.7))); // expected-note{{marked partial here}} -int fn_10_8() __attribute__((availability(macosx, introduced=10.8))) { // expected-note{{marked partial here}} +int fn_10_7() __attribute__((availability(macosx, introduced=10.7))); // expected-note{{'fn_10_7' has been marked as being introduced in macOS 10.7 here, but the deployment target is macOS 10.5.0}} +int fn_10_8() __attribute__((availability(macosx, introduced=10.8))) { // expected-note{{'fn_10_8' has been marked as being introduced in macOS 10.8 here, but the deployment target is macOS 10.5.0}} return fn_10_7(); } diff --git a/clang/test/SemaObjC/property-deprecated-warning.m b/clang/test/SemaObjC/property-deprecated-warning.m index 0591c78fba4..a1e971118b2 100644 --- a/clang/test/SemaObjC/property-deprecated-warning.m +++ b/clang/test/SemaObjC/property-deprecated-warning.m @@ -9,7 +9,7 @@ typedef signed char BOOL; @property(nonatomic,assign) id ptarget __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{property 'ptarget' is declared deprecated here}} expected-note {{'ptarget' has been explicitly marked deprecated here}} #if defined(WARN_PARTIAL) -// expected-note@+2 {{'partialPtarget' has been explicitly marked partial here}} +// expected-note@+2 {{'partialPtarget' has been marked as being introduced in iOS 5.0 here, but the deployment target is iOS 3.0.0}} #endif @property(nonatomic,assign) id partialPtarget __attribute__((availability(ios,introduced=5.0))); @end @@ -24,7 +24,7 @@ typedef signed char BOOL; @property(nonatomic,assign) id target __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{property 'target' is declared deprecated here}} expected-note {{'setTarget:' has been explicitly marked deprecated here}} #if defined(WARN_PARTIAL) -// expected-note@+2 {{'setPartialTarget:' has been explicitly marked partial here}} +// expected-note@+2 {{'setPartialTarget:' has been marked as being introduced in iOS 5.0 here, but the deployment target is iOS 3.0.0}} #endif @property(nonatomic,assign) id partialTarget __attribute__((availability(ios,introduced=5.0))); @end @@ -40,7 +40,8 @@ typedef signed char BOOL; // expected-note 2 {{'setDep_target:' has been explicitly marked deprecated here}} #if defined(WARN_PARTIAL) -// expected-note@+2 2 {{'partial_dep_target' has been explicitly marked partial here}} expected-note@+2 2 {{'setPartial_dep_target:' has been explicitly marked partial here}} +// expected-note@+3 2 {{'partial_dep_target' has been marked as being introduced in iOS 5.0 here, but the deployment target is iOS 3.0.0}} +// expected-note@+2 2 {{'setPartial_dep_target:' has been marked as being introduced in iOS 5.0 here, but the deployment target is iOS 3.0.0}} #endif @property(nonatomic,assign) id partial_dep_target __attribute__((availability(ios,introduced=5.0))); @end @@ -100,12 +101,12 @@ typedef signed char BOOL; @property(setter=setNewDelegate:,assign) id delegate __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{'setNewDelegate:' has been explicitly marked deprecated here}} expected-note {{property 'delegate' is declared deprecated here}} #if defined(WARN_PARTIAL) -// expected-note@+2 {{'partialIsEnabled' has been explicitly marked partial here}} +// expected-note@+2 {{'partialIsEnabled' has been marked as being introduced in iOS 5.0 here, but the deployment target is iOS 3.0.0}} #endif @property(getter=partialIsEnabled,assign) BOOL partialEnabled __attribute__((availability(ios,introduced=5.0))); #if defined(WARN_PARTIAL) -// expected-note@+2 {{'partialSetNewDelegate:' has been explicitly marked partial here}} +// expected-note@+2 {{'partialSetNewDelegate:' has been marked as being introduced in iOS 5.0 here, but the deployment target is iOS 3.0.0}} #endif @property(setter=partialSetNewDelegate:,assign) id partialDelegate __attribute__((availability(ios,introduced=5.0))); @end diff --git a/clang/test/SemaObjC/unguarded-availability-new.m b/clang/test/SemaObjC/unguarded-availability-new.m index 474730f0d36..ed61bf97795 100644 --- a/clang/test/SemaObjC/unguarded-availability-new.m +++ b/clang/test/SemaObjC/unguarded-availability-new.m @@ -68,15 +68,15 @@ void previouslyAvailable() AVAILABLE_PREV; #ifdef WARN_PREV - // expected-note@-2 {{'previouslyAvailable' has been explicitly marked partial here}} +// expected-note@-2 {{'previouslyAvailable' has been marked as being introduced}} #endif void currentlyAvailable() AVAILABLE_CURRENT; #ifdef WARN_CURRENT - // expected-note@-2 {{'currentlyAvailable' has been explicitly marked partial here}} +// expected-note@-2 {{'currentlyAvailable' has been marked as being introduced}} #endif void willBeAvailabile() AVAILABLE_NEXT; #ifndef NO_WARNING - // expected-note@-2 {{'willBeAvailabile' has been explicitly marked partial here}} +// expected-note@-2 {{'willBeAvailabile' has been marked as being introduced in}} #endif #ifdef TEST_FUNC_CURRENT @@ -91,7 +91,7 @@ void willBeAvailabile() AVAILABLE_NEXT; typedef int AVAILABLE_NEXT new_int; #ifndef NO_WARNING - // expected-note@-2 {{'new_int' has been explicitly marked partial here}} +// expected-note@-2 {{'new_int' has been marked as being introduced in}} #endif FUNC_AVAILABLE new_int x; #ifndef NO_WARNING diff --git a/clang/test/SemaObjC/unguarded-availability.m b/clang/test/SemaObjC/unguarded-availability.m index 39c63109798..c185a363cd6 100644 --- a/clang/test/SemaObjC/unguarded-availability.m +++ b/clang/test/SemaObjC/unguarded-availability.m @@ -1,18 +1,18 @@ -// RUN: %clang_cc1 -triple x86_64-apple-macosx-10.9 -Wunguarded-availability -fblocks -fsyntax-only -verify %s -// RUN: %clang_cc1 -xobjective-c++ -std=c++11 -DOBJCPP -triple x86_64-apple-macosx-10.9 -Wunguarded-availability -fblocks -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -Wunguarded-availability -fblocks -fsyntax-only -verify %s +// RUN: %clang_cc1 -xobjective-c++ -std=c++11 -DOBJCPP -triple x86_64-apple-macosx10.9 -Wunguarded-availability -fblocks -fsyntax-only -verify %s #define AVAILABLE_10_0 __attribute__((availability(macos, introduced = 10.0))) #define AVAILABLE_10_11 __attribute__((availability(macos, introduced = 10.11))) #define AVAILABLE_10_12 __attribute__((availability(macos, introduced = 10.12))) -typedef int AVAILABLE_10_12 new_int; // expected-note + {{marked partial here}} +typedef int AVAILABLE_10_12 new_int; // expected-note + {{'new_int' has been marked as being introduced in macOS 10.12 here, but the deployment target is macOS 10.9.0}} -int func_10_11() AVAILABLE_10_11; // expected-note 8 {{'func_10_11' has been explicitly marked partial here}} +int func_10_11() AVAILABLE_10_11; // expected-note 8 {{'func_10_11' has been marked as being introduced in macOS 10.11 here, but the deployment target is macOS 10.9.0}} #ifdef OBJCPP -// expected-note@+2 6 {{marked partial here}} +// expected-note@+2 6 {{'func_10_12' has been marked as being introduced in macOS 10.12 here, but the deployment target is macOS 10.9.0}} #endif -int func_10_12() AVAILABLE_10_12; // expected-note 7 {{'func_10_12' has been explicitly marked partial here}} +int func_10_12() AVAILABLE_10_12; // expected-note 7 {{'func_10_12' has been marked as being introduced in macOS 10.12 here, but the deployment target is macOS 10.9.0}} int func_10_0() AVAILABLE_10_0; @@ -61,11 +61,11 @@ void star_case() { } } -typedef int int_10_11 AVAILABLE_10_11; // expected-note {{'int_10_11' has been explicitly marked partial here}} +typedef int int_10_11 AVAILABLE_10_11; // expected-note {{'int_10_11' has been marked as being introduced in macOS 10.11 here, but the deployment target is macOS 10.9.0}} #ifdef OBJCPP -// expected-note@+2 {{marked partial here}} +// expected-note@+2 {{'int_10_12' has been marked as being introduced in macOS 10.12 here, but the deployment target is macOS 10.9.0}} #endif -typedef int int_10_12 AVAILABLE_10_12; // expected-note 2 {{'int_10_12' has been explicitly marked partial here}} +typedef int int_10_12 AVAILABLE_10_12; // expected-note 2 {{'int_10_12' has been marked as being introduced in macOS 10.12 here, but the deployment target is macOS 10.9.0}} void use_typedef() { int_10_11 x; // expected-warning{{'int_10_11' is only available on macOS 10.11 or newer}} expected-note{{enclose 'int_10_11' in an @available check to silence this warning}} @@ -106,10 +106,10 @@ int protected_scope() { struct S { int m1; - int m2 __attribute__((availability(macos, introduced = 10.12))); // expected-note{{marked partial here}} + int m2 __attribute__((availability(macos, introduced = 10.12))); // expected-note{{has been marked as being introduced in macOS 10.12 here, but the deployment target is macOS 10.9.0}} struct Nested { - int nested_member __attribute__((availability(macos, introduced = 10.12))); // expected-note{{marked partial here}} + int nested_member __attribute__((availability(macos, introduced = 10.12))); // expected-note{{'nested_member' has been marked as being introduced in macOS 10.12 here, but the deployment target is macOS 10.9.0}} } n; }; @@ -139,9 +139,9 @@ void (^topLevelBlockDecl)() = ^ { AVAILABLE_10_12 __attribute__((objc_root_class)) -@interface InterWithProp // expected-note 2 {{marked partial here}} +@interface InterWithProp // expected-note 2 {{'InterWithProp' has been marked as being introduced in macOS 10.12 here, but the deployment target is macOS 10.9.0}} @property(class) int x; -+ (void) setX: (int)newX AVAILABLE_10_12; // expected-note{{marked partial here}} ++ (void) setX: (int)newX AVAILABLE_10_12; // expected-note{{'setX:' has been marked as being introduced in macOS 10.12 here, but the deployment target is macOS 10.9.0}} @end void test_property(void) { int y = InterWithProp.x; // expected-warning{{'InterWithProp' is only available on macOS 10.12 or newer}} expected-note{{@available}} @@ -150,7 +150,7 @@ void test_property(void) { __attribute__((objc_root_class)) @interface Subscriptable -- (id)objectAtIndexedSubscript:(int)sub AVAILABLE_10_12; // expected-note{{marked partial here}} +- (id)objectAtIndexedSubscript:(int)sub AVAILABLE_10_12; // expected-note{{'objectAtIndexedSubscript:' has been marked as being introduced in macOS 10.12 here, but the deployment target is macOS 10.9.0}} @end void test_at(Subscriptable *x) { @@ -196,7 +196,7 @@ int instantiate_template() { } template <class> -int with_availability_attr() AVAILABLE_10_11 { // expected-note 2 {{marked partial here}} +int with_availability_attr() AVAILABLE_10_11 { // expected-note 2 {{'with_availability_attr<int>' has been marked as being introduced in macOS 10.11 here, but the deployment target is macOS 10.9.0}} return 0; } @@ -244,7 +244,7 @@ struct InStruct { // expected-note{{annotate 'InStruct' with an availability att }; #ifdef OBJCPP -static constexpr int AVAILABLE_10_12 SomeConstexprValue = 2; // expected-note{{marked partial here}} +static constexpr int AVAILABLE_10_12 SomeConstexprValue = 2; // expected-note{{'SomeConstexprValue' has been marked as being introduced in macOS 10.12 here, but the deployment target is macOS 10.9.0}} typedef enum { // expected-note{{annotate anonymous enum with an availability attribute}} SomeValue = SomeConstexprValue // expected-warning{{'SomeConstexprValue' is only available on macOS 10.12 or newer}} } SomeEnum; @@ -268,7 +268,7 @@ void with_local_struct() { // Avoid the warning on protocol requirements. AVAILABLE_10_12 -@protocol NewProtocol // expected-note {{'NewProtocol' has been explicitly marked partial here}} +@protocol NewProtocol // expected-note {{'NewProtocol' has been marked as being introduced in macOS 10.12 here, but the deployment target is macOS 10.9.0}} @end @protocol ProtocolWithNewProtocolRequirement <NewProtocol> // expected-note {{annotate 'ProtocolWithNewProtocolRequirement' with an availability attribute to silence}} @@ -291,7 +291,7 @@ AVAILABLE_10_12 typedef enum { AK_Dodo __attribute__((availability(macos, deprecated=10.3))), // expected-note 3 {{marked deprecated here}} AK_Cat __attribute__((availability(macos, introduced=10.4))), - AK_CyborgCat __attribute__((availability(macos, introduced=10.12))), // expected-note {{marked partial here}} + AK_CyborgCat __attribute__((availability(macos, introduced=10.12))), // expected-note {{'AK_CyborgCat' has been marked as being introduced in macOS 10.12 here, but the deployment target is macOS 10.9.0}} } Animals; void switchAnimals(Animals a) { |