diff options
Diffstat (limited to 'clang/test')
23 files changed, 197 insertions, 197 deletions
diff --git a/clang/test/Analysis/retain-release.m b/clang/test/Analysis/retain-release.m index 1dbcda507c1..f0d91e34c1b 100644 --- a/clang/test/Analysis/retain-release.m +++ b/clang/test/Analysis/retain-release.m @@ -2165,7 +2165,7 @@ void testCFReturnsNotRetained() { } void testCFReturnsNotRetainedAnnotated() { - extern void getViaParam2(CFTypeRef * __nonnull CF_RETURNS_NOT_RETAINED outObj); + extern void getViaParam2(CFTypeRef * _Nonnull CF_RETURNS_NOT_RETAINED outObj); CFTypeRef obj; getViaParam2(&obj); CFRelease(obj); // // expected-warning {{Incorrect decrement of the reference count of an object that is not owned at this point by the caller}} diff --git a/clang/test/FixIt/fixit-nullability-declspec.cpp b/clang/test/FixIt/fixit-nullability-declspec.cpp index 2ac20b9d9b4..17989c3a885 100644 --- a/clang/test/FixIt/fixit-nullability-declspec.cpp +++ b/clang/test/FixIt/fixit-nullability-declspec.cpp @@ -4,6 +4,6 @@ // RUN: not %clang_cc1 -fixit -fblocks -Werror=nullability-declspec -x c++ %t // RUN: %clang_cc1 -fblocks -Werror=nullability-declspec -x c++ %t -__nullable int *ip1; // expected-error{{nullability specifier '__nullable' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the pointer?}} -__nullable int (*fp1)(int); // expected-error{{nullability specifier '__nullable' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the function pointer?}} -__nonnull int (^bp1)(int); // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the block pointer?}} +_Nullable int *ip1; // expected-error{{nullability specifier '_Nullable' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the pointer?}} +_Nullable int (*fp1)(int); // expected-error{{nullability specifier '_Nullable' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the function pointer?}} +_Nonnull int (^bp1)(int); // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the block pointer?}} diff --git a/clang/test/Index/complete-objc-message.m b/clang/test/Index/complete-objc-message.m index a62b49194e8..193f1f8bf22 100644 --- a/clang/test/Index/complete-objc-message.m +++ b/clang/test/Index/complete-objc-message.m @@ -345,4 +345,4 @@ void test_Nullability(Nullability *n, A* a) { // CHECK-DISTRIB-OBJECTS: ObjCInstanceMethodDecl:{ResultType void}{TypedText method:}{Placeholder (in bycopy A *)}{HorizontalSpace }{TypedText result:}{Placeholder (out byref A **)} (35) // RUN: c-index-test -code-completion-at=%s:197:6 %s | FileCheck -check-prefix=CHECK-NULLABLE %s -// CHECK-NULLABLE: ObjCInstanceMethodDecl:{ResultType A * __nonnull}{TypedText method:}{Placeholder (nullable A *)} +// CHECK-NULLABLE: ObjCInstanceMethodDecl:{ResultType A * _Nonnull}{TypedText method:}{Placeholder (nullable A *)} diff --git a/clang/test/Index/complete-stmt.c b/clang/test/Index/complete-stmt.c index 8bbfe2db56d..0deb4d371c2 100644 --- a/clang/test/Index/complete-stmt.c +++ b/clang/test/Index/complete-stmt.c @@ -16,8 +16,8 @@ void f(int x) { // CHECK-IF-ELSE-SIMPLE: NotImplemented:{TypedText else}{HorizontalSpace }{Text if}{HorizontalSpace }{LeftParen (}{Placeholder expression}{RightParen )} (40) // RUN: c-index-test -code-completion-at=%s:6:1 %s | FileCheck -check-prefix=CHECK-STMT %s -// CHECK-STMT: NotImplemented:{TypedText __nonnull} (50) -// CHECK-STMT: NotImplemented:{TypedText __nullable} (50) +// CHECK-STMT: NotImplemented:{TypedText _Nonnull} (50) +// CHECK-STMT: NotImplemented:{TypedText _Nullable} (50) // CHECK-STMT: NotImplemented:{TypedText char} (50) // CHECK-STMT: NotImplemented:{TypedText const} (50) // CHECK-STMT: NotImplemented:{TypedText double} (50) diff --git a/clang/test/Parser/nullability.c b/clang/test/Parser/nullability.c index f2b6abf73dc..f500e79d7d1 100644 --- a/clang/test/Parser/nullability.c +++ b/clang/test/Parser/nullability.c @@ -1,10 +1,10 @@ // RUN: %clang_cc1 -fsyntax-only -std=c99 -Wno-nullability-declspec -pedantic %s -verify -__nonnull int *ptr; // expected-warning{{type nullability specifier '__nonnull' is a Clang extension}} +_Nonnull int *ptr; // expected-warning{{type nullability specifier '_Nonnull' is a Clang extension}} #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wnullability-extension" -__nonnull int *ptr2; // no-warning +_Nonnull int *ptr2; // no-warning #pragma clang diagnostic pop #if __has_feature(nullability) diff --git a/clang/test/Sema/non-null-warning.c b/clang/test/Sema/non-null-warning.c index 6cd98e298e2..024ef1eca66 100644 --- a/clang/test/Sema/non-null-warning.c +++ b/clang/test/Sema/non-null-warning.c @@ -7,29 +7,29 @@ #endif -int * __nullable foo(int * __nonnull x); +int * _Nullable foo(int * _Nonnull x); -int *__nonnull ret_nonnull(); +int *_Nonnull ret_nonnull(); int *foo(int *x) { return 0; } -int * __nullable foo1(int * __nonnull x); // expected-note {{previous declaration is here}} +int * _Nullable foo1(int * _Nonnull x); // expected-note {{previous declaration is here}} -int *foo1(int * __nullable x) { // expected-warning {{nullability specifier '__nullable' conflicts with existing specifier '__nonnull'}} +int *foo1(int * _Nullable x) { // expected-warning {{nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'}} return 0; } -int * __nullable foo2(int * __nonnull x); +int * _Nullable foo2(int * _Nonnull x); -int *foo2(int * __nonnull x) { +int *foo2(int * _Nonnull x) { return 0; } -int * __nullable foo3(int * __nullable x); // expected-note {{previous declaration is here}} +int * _Nullable foo3(int * _Nullable x); // expected-note {{previous declaration is here}} -int *foo3(int * __nonnull x) { // expected-warning {{nullability specifier '__nonnull' conflicts with existing specifier '__nullable'}} +int *foo3(int * _Nonnull x) { // expected-warning {{nullability specifier '_Nonnull' conflicts with existing specifier '_Nullable'}} return 0; } diff --git a/clang/test/Sema/nullability.c b/clang/test/Sema/nullability.c index 6144b7e8e9e..59644c4193a 100644 --- a/clang/test/Sema/nullability.c +++ b/clang/test/Sema/nullability.c @@ -8,88 +8,88 @@ typedef int * int_ptr; // Parse nullability type specifiers. -typedef int * __nonnull nonnull_int_ptr; // expected-note{{'__nonnull' specified here}} -typedef int * __nullable nullable_int_ptr; -typedef int * __null_unspecified null_unspecified_int_ptr; +typedef int * _Nonnull nonnull_int_ptr; // expected-note{{'_Nonnull' specified here}} +typedef int * _Nullable nullable_int_ptr; +typedef int * _Null_unspecified null_unspecified_int_ptr; // Redundant nullability type specifiers. -typedef int * __nonnull __nonnull redundant_1; // expected-warning{{duplicate nullability specifier '__nonnull'}} +typedef int * _Nonnull _Nonnull redundant_1; // expected-warning{{duplicate nullability specifier '_Nonnull'}} // Conflicting nullability type specifiers. -typedef int * __nonnull __nullable conflicting_1; // expected-error{{nullability specifier '__nonnull' conflicts with existing specifier '__nullable'}} -typedef int * __null_unspecified __nonnull conflicting_2; // expected-error{{nullability specifier '__null_unspecified' conflicts with existing specifier '__nonnull'}} +typedef int * _Nonnull _Nullable conflicting_1; // expected-error{{nullability specifier '_Nonnull' conflicts with existing specifier '_Nullable'}} +typedef int * _Null_unspecified _Nonnull conflicting_2; // expected-error{{nullability specifier '_Null_unspecified' conflicts with existing specifier '_Nonnull'}} // Redundant nullability specifiers via a typedef are okay. -typedef nonnull_int_ptr __nonnull redundant_okay_1; +typedef nonnull_int_ptr _Nonnull redundant_okay_1; // Conflicting nullability specifiers via a typedef are not. -typedef nonnull_int_ptr __nullable conflicting_2; // expected-error{{nullability specifier '__nullable' conflicts with existing specifier '__nonnull'}} +typedef nonnull_int_ptr _Nullable conflicting_2; // expected-error{{nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'}} typedef nonnull_int_ptr nonnull_int_ptr_typedef; -typedef nonnull_int_ptr_typedef __nullable conflicting_2; // expected-error{{nullability specifier '__nullable' conflicts with existing specifier '__nonnull'}} +typedef nonnull_int_ptr_typedef _Nullable conflicting_2; // expected-error{{nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'}} typedef nonnull_int_ptr_typedef nonnull_int_ptr_typedef_typedef; -typedef nonnull_int_ptr_typedef_typedef __null_unspecified conflicting_3; // expected-error{{nullability specifier '__null_unspecified' conflicts with existing specifier '__nonnull'}} +typedef nonnull_int_ptr_typedef_typedef _Null_unspecified conflicting_3; // expected-error{{nullability specifier '_Null_unspecified' conflicts with existing specifier '_Nonnull'}} // Nullability applies to all pointer types. -typedef int (* __nonnull function_pointer_type_1)(int, int); -typedef int (^ __nonnull block_type_1)(int, int); +typedef int (* _Nonnull function_pointer_type_1)(int, int); +typedef int (^ _Nonnull block_type_1)(int, int); // Nullability must be on a pointer type. -typedef int __nonnull int_type_1; // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'int'}} +typedef int _Nonnull int_type_1; // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'int'}} // Nullability can move out to a pointer/block pointer declarator // (with a suppressed warning). -typedef __nonnull int * nonnull_int_ptr_2; -typedef int __nullable * nullable_int_ptr_2; -typedef __nonnull int (* function_pointer_type_2)(int, int); -typedef __nonnull int (^ block_type_2)(int, int); -typedef __nonnull int * * __nullable nonnull_int_ptr_ptr_1; -typedef __nonnull int *(^ block_type_3)(int, int); -typedef __nonnull int *(* function_pointer_type_3)(int, int); -typedef __nonnull int_ptr (^ block_type_4)(int, int); -typedef __nonnull int_ptr (* function_pointer_type_4)(int, int); - -void acceptFunctionPtr(__nonnull int *(*)(void)); -void acceptBlockPtr(__nonnull int *(^)(void)); +typedef _Nonnull int * nonnull_int_ptr_2; +typedef int _Nullable * nullable_int_ptr_2; +typedef _Nonnull int (* function_pointer_type_2)(int, int); +typedef _Nonnull int (^ block_type_2)(int, int); +typedef _Nonnull int * * _Nullable nonnull_int_ptr_ptr_1; +typedef _Nonnull int *(^ block_type_3)(int, int); +typedef _Nonnull int *(* function_pointer_type_3)(int, int); +typedef _Nonnull int_ptr (^ block_type_4)(int, int); +typedef _Nonnull int_ptr (* function_pointer_type_4)(int, int); + +void acceptFunctionPtr(_Nonnull int *(*)(void)); +void acceptBlockPtr(_Nonnull int *(^)(void)); void testBlockFunctionPtrNullability() { float *fp; - fp = (function_pointer_type_3)0; // expected-warning{{from 'function_pointer_type_3' (aka 'int * __nonnull (*)(int, int)')}} - fp = (block_type_3)0; // expected-error{{from incompatible type 'block_type_3' (aka 'int * __nonnull (^)(int, int)')}} - fp = (function_pointer_type_4)0; // expected-warning{{from 'function_pointer_type_4' (aka 'int_ptr __nonnull (*)(int, int)')}} - fp = (block_type_4)0; // expected-error{{from incompatible type 'block_type_4' (aka 'int_ptr __nonnull (^)(int, int)')}} + fp = (function_pointer_type_3)0; // expected-warning{{from 'function_pointer_type_3' (aka 'int * _Nonnull (*)(int, int)')}} + fp = (block_type_3)0; // expected-error{{from incompatible type 'block_type_3' (aka 'int * _Nonnull (^)(int, int)')}} + fp = (function_pointer_type_4)0; // expected-warning{{from 'function_pointer_type_4' (aka 'int_ptr _Nonnull (*)(int, int)')}} + fp = (block_type_4)0; // expected-error{{from incompatible type 'block_type_4' (aka 'int_ptr _Nonnull (^)(int, int)')}} acceptFunctionPtr(0); // no-warning acceptBlockPtr(0); // no-warning } // Moving nullability where it creates a conflict. -typedef __nonnull int * __nullable * conflict_int_ptr_ptr_2; // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'int'}} +typedef _Nonnull int * _Nullable * conflict_int_ptr_ptr_2; // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'int'}} // Nullability is not part of the canonical type. -typedef int * __nonnull ambiguous_int_ptr; +typedef int * _Nonnull ambiguous_int_ptr; typedef int * ambiguous_int_ptr; -typedef int * __nullable ambiguous_int_ptr; +typedef int * _Nullable ambiguous_int_ptr; // Printing of nullability. float f; -int * __nonnull ip_1 = &f; // expected-warning{{incompatible pointer types initializing 'int * __nonnull' with an expression of type 'float *'}} +int * _Nonnull ip_1 = &f; // expected-warning{{incompatible pointer types initializing 'int * _Nonnull' with an expression of type 'float *'}} // Check printing of nullability specifiers. void printing_nullability(void) { - int * __nonnull iptr; - float *fptr = iptr; // expected-warning{{incompatible pointer types initializing 'float *' with an expression of type 'int * __nonnull'}} + int * _Nonnull iptr; + float *fptr = iptr; // expected-warning{{incompatible pointer types initializing 'float *' with an expression of type 'int * _Nonnull'}} - int * * __nonnull iptrptr; - float **fptrptr = iptrptr; // expected-warning{{incompatible pointer types initializing 'float **' with an expression of type 'int ** __nonnull'}} + int * * _Nonnull iptrptr; + float **fptrptr = iptrptr; // expected-warning{{incompatible pointer types initializing 'float **' with an expression of type 'int ** _Nonnull'}} - int * __nullable * __nonnull iptrptr2; - float * *fptrptr2 = iptrptr2; // expected-warning{{incompatible pointer types initializing 'float **' with an expression of type 'int * __nullable * __nonnull'}} + int * _Nullable * _Nonnull iptrptr2; + float * *fptrptr2 = iptrptr2; // expected-warning{{incompatible pointer types initializing 'float **' with an expression of type 'int * _Nullable * _Nonnull'}} } -// Check passing null to a __nonnull argument. -void accepts_nonnull_1(__nonnull int *ptr); -void (*accepts_nonnull_2)(__nonnull int *ptr); -void (^accepts_nonnull_3)(__nonnull int *ptr); +// Check passing null to a _Nonnull argument. +void accepts_nonnull_1(_Nonnull int *ptr); +void (*accepts_nonnull_2)(_Nonnull int *ptr); +void (^accepts_nonnull_3)(_Nonnull int *ptr); void test_accepts_nonnull_null_pointer_literal() { accepts_nonnull_1(0); // expected-warning{{null passed to a callee that requires a non-null argument}} @@ -97,17 +97,17 @@ void test_accepts_nonnull_null_pointer_literal() { accepts_nonnull_3(0); // expected-warning{{null passed to a callee that requires a non-null argument}} } -// Check returning nil from a __nonnull-returning function. -__nonnull int *returns_int_ptr(int x) { +// Check returning nil from a _Nonnull-returning function. +_Nonnull int *returns_int_ptr(int x) { if (x) { return 0; // expected-warning{{null returned from function that requires a non-null return value}} } - return (__nonnull int *)0; + return (_Nonnull int *)0; } // Check nullable-to-nonnull conversions. -void nullable_to_nonnull(__nullable int *ptr) { +void nullable_to_nonnull(_Nullable int *ptr) { int *a = ptr; // okay - __nonnull int *b = ptr; // expected-warning{{implicit conversion from nullable pointer 'int * __nullable' to non-nullable pointer type 'int * __nonnull'}} + _Nonnull int *b = ptr; // expected-warning{{implicit conversion from nullable pointer 'int * _Nullable' to non-nullable pointer type 'int * _Nonnull'}} } diff --git a/clang/test/SemaCXX/nullability-declspec.cpp b/clang/test/SemaCXX/nullability-declspec.cpp index ef1a171c4dd..1a3a321ab22 100644 --- a/clang/test/SemaCXX/nullability-declspec.cpp +++ b/clang/test/SemaCXX/nullability-declspec.cpp @@ -2,8 +2,8 @@ struct X { }; -__nullable int *ip1; // expected-error{{nullability specifier '__nullable' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the pointer?}} -__nullable int (*fp1)(int); // expected-error{{nullability specifier '__nullable' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the function pointer?}} -__nonnull int (^bp1)(int); // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the block pointer?}} -__nonnull int X::*pmd1; // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the member pointer?}} -__nonnull int (X::*pmf1)(int); // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the member function pointer?}} +_Nullable int *ip1; // expected-error{{nullability specifier '_Nullable' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the pointer?}} +_Nullable int (*fp1)(int); // expected-error{{nullability specifier '_Nullable' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the function pointer?}} +_Nonnull int (^bp1)(int); // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the block pointer?}} +_Nonnull int X::*pmd1; // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the member pointer?}} +_Nonnull int (X::*pmf1)(int); // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the member function pointer?}} diff --git a/clang/test/SemaCXX/nullability.cpp b/clang/test/SemaCXX/nullability.cpp index f0aa13be8fa..fa5d344a953 100644 --- a/clang/test/SemaCXX/nullability.cpp +++ b/clang/test/SemaCXX/nullability.cpp @@ -6,24 +6,24 @@ class X { }; // Nullability applies to all pointer types. -typedef int (X::* __nonnull member_function_type_1)(int); -typedef int X::* __nonnull member_data_type_1; -typedef nullptr_t __nonnull nonnull_nullptr_t; // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'nullptr_t'}} +typedef int (X::* _Nonnull member_function_type_1)(int); +typedef int X::* _Nonnull member_data_type_1; +typedef nullptr_t _Nonnull nonnull_nullptr_t; // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'nullptr_t'}} // Nullability can move into member pointers (this is suppressing a warning). -typedef __nonnull int (X::* member_function_type_2)(int); -typedef int (X::* __nonnull member_function_type_3)(int); -typedef __nonnull int X::* member_data_type_2; +typedef _Nonnull int (X::* member_function_type_2)(int); +typedef int (X::* _Nonnull member_function_type_3)(int); +typedef _Nonnull int X::* member_data_type_2; // Adding non-null via a template. template<typename T> struct AddNonNull { - typedef __nonnull T type; // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'int'}} - // expected-error@-1{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'nullptr_t'}} + typedef _Nonnull T type; // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'int'}} + // expected-error@-1{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'nullptr_t'}} }; typedef AddNonNull<int *>::type nonnull_int_ptr_1; -typedef AddNonNull<int * __nullable>::type nonnull_int_ptr_2; // FIXME: check that it was overridden +typedef AddNonNull<int * _Nullable>::type nonnull_int_ptr_2; // FIXME: check that it was overridden typedef AddNonNull<nullptr_t>::type nonnull_int_ptr_3; // expected-note{{in instantiation of template class}} typedef AddNonNull<int>::type nonnull_non_pointer_1; // expected-note{{in instantiation of template class 'AddNonNull<int>' requested here}} @@ -31,22 +31,22 @@ typedef AddNonNull<int>::type nonnull_non_pointer_1; // expected-note{{in instan // Non-null checking within a template. template<typename T> struct AddNonNull2 { - typedef __nonnull AddNonNull<T> invalid1; // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'AddNonNull<T>'}} - typedef __nonnull AddNonNull2 invalid2; // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'AddNonNull2<T>'}} - typedef __nonnull AddNonNull2<T> invalid3; // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'AddNonNull2<T>'}} - typedef __nonnull typename AddNonNull<T>::type okay1; + typedef _Nonnull AddNonNull<T> invalid1; // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'AddNonNull<T>'}} + typedef _Nonnull AddNonNull2 invalid2; // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'AddNonNull2<T>'}} + typedef _Nonnull AddNonNull2<T> invalid3; // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'AddNonNull2<T>'}} + typedef _Nonnull typename AddNonNull<T>::type okay1; // Don't move past a dependent type even if we know that nullability // cannot apply to that specific dependent type. - typedef __nonnull AddNonNull<T> (*invalid4); // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'AddNonNull<T>'}} + typedef _Nonnull AddNonNull<T> (*invalid4); // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'AddNonNull<T>'}} }; -// Check passing null to a __nonnull argument. -void (*accepts_nonnull_1)(__nonnull int *ptr); -void (*& accepts_nonnull_2)(__nonnull int *ptr) = accepts_nonnull_1; -void (X::* accepts_nonnull_3)(__nonnull int *ptr); -void accepts_nonnull_4(__nonnull int *ptr); -void (&accepts_nonnull_5)(__nonnull int *ptr) = accepts_nonnull_4; +// Check passing null to a _Nonnull argument. +void (*accepts_nonnull_1)(_Nonnull int *ptr); +void (*& accepts_nonnull_2)(_Nonnull int *ptr) = accepts_nonnull_1; +void (X::* accepts_nonnull_3)(_Nonnull int *ptr); +void accepts_nonnull_4(_Nonnull int *ptr); +void (&accepts_nonnull_5)(_Nonnull int *ptr) = accepts_nonnull_4; void test_accepts_nonnull_null_pointer_literal(X *x) { accepts_nonnull_1(0); // expected-warning{{null passed to a callee that requires a non-null argument}} @@ -56,7 +56,7 @@ void test_accepts_nonnull_null_pointer_literal(X *x) { accepts_nonnull_5(0); // expected-warning{{null passed to a callee that requires a non-null argument}} } -template<void FP(__nonnull int*)> +template<void FP(_Nonnull int*)> void test_accepts_nonnull_null_pointer_literal_template() { FP(0); // expected-warning{{null passed to a callee that requires a non-null argument}} } diff --git a/clang/test/SemaObjC/arc-unavailable-for-weakref.m b/clang/test/SemaObjC/arc-unavailable-for-weakref.m index 53ceaa15c28..35d5d983044 100644 --- a/clang/test/SemaObjC/arc-unavailable-for-weakref.m +++ b/clang/test/SemaObjC/arc-unavailable-for-weakref.m @@ -56,7 +56,7 @@ __attribute__((objc_arc_weak_reference_unavailable)) @interface I { } -@property (weak) NSFont *font; // expected-error {{synthesizing __weak instance variable of type 'NSFont * __nullable', which does not support weak references}} +@property (weak) NSFont *font; // expected-error {{synthesizing __weak instance variable of type 'NSFont * _Nullable', which does not support weak references}} @end @implementation I // expected-note {{when implemented by class I}} @@ -65,7 +65,7 @@ __attribute__((objc_arc_weak_reference_unavailable)) // rdar://13676793 @protocol MyProtocol -@property (weak) NSFont *font; // expected-error {{synthesizing __weak instance variable of type 'NSFont * __nullable', which does not support weak references}} +@property (weak) NSFont *font; // expected-error {{synthesizing __weak instance variable of type 'NSFont * _Nullable', which does not support weak references}} @end @interface I1 <MyProtocol> @@ -76,7 +76,7 @@ __attribute__((objc_arc_weak_reference_unavailable)) @end @interface Super -@property (weak) NSFont *font; // expected-error {{synthesizing __weak instance variable of type 'NSFont * __nullable', which does not support weak references}} +@property (weak) NSFont *font; // expected-error {{synthesizing __weak instance variable of type 'NSFont * _Nullable', which does not support weak references}} @end diff --git a/clang/test/SemaObjC/nullability-arc.m b/clang/test/SemaObjC/nullability-arc.m index 917a808386d..1c303e8300c 100644 --- a/clang/test/SemaObjC/nullability-arc.m +++ b/clang/test/SemaObjC/nullability-arc.m @@ -5,6 +5,6 @@ __attribute__((objc_root_class)) @end // ARC qualifiers stacked with nullability. -void accepts_arc_qualified(NSFoo * __unsafe_unretained __nonnull obj) { +void accepts_arc_qualified(NSFoo * __unsafe_unretained _Nonnull obj) { accepts_arc_qualified(0); // expected-warning{{null passed to a callee that requires a non-null argument}} } diff --git a/clang/test/SemaObjC/nullability.m b/clang/test/SemaObjC/nullability.m index ca8c2fcd321..36ac6b9ddea 100644 --- a/clang/test/SemaObjC/nullability.m +++ b/clang/test/SemaObjC/nullability.m @@ -2,29 +2,29 @@ __attribute__((objc_root_class)) @interface NSFoo -- (void)methodTakingIntPtr:(__nonnull int *)ptr; -- (__nonnull int *)methodReturningIntPtr; +- (void)methodTakingIntPtr:(_Nonnull int *)ptr; +- (_Nonnull int *)methodReturningIntPtr; @end // Nullability applies to all pointer types. -typedef NSFoo * __nonnull nonnull_NSFoo_ptr; -typedef id __nonnull nonnull_id; -typedef SEL __nonnull nonnull_SEL; +typedef NSFoo * _Nonnull nonnull_NSFoo_ptr; +typedef id _Nonnull nonnull_id; +typedef SEL _Nonnull nonnull_SEL; // Nullability can move into Objective-C pointer types. -typedef __nonnull NSFoo * nonnull_NSFoo_ptr_2; +typedef _Nonnull NSFoo * nonnull_NSFoo_ptr_2; // Conflicts from nullability moving into Objective-C pointer type. -typedef __nonnull NSFoo * __nullable conflict_NSFoo_ptr_2; // expected-error{{'__nonnull' cannot be applied to non-pointer type 'NSFoo'}} +typedef _Nonnull NSFoo * _Nullable conflict_NSFoo_ptr_2; // expected-error{{'_Nonnull' cannot be applied to non-pointer type 'NSFoo'}} -void testBlocksPrinting(NSFoo * __nullable (^bp)(int)) { - int *ip = bp; // expected-error{{'NSFoo * __nullable (^)(int)'}} +void testBlocksPrinting(NSFoo * _Nullable (^bp)(int)) { + int *ip = bp; // expected-error{{'NSFoo * _Nullable (^)(int)'}} } -// Check returning nil from a __nonnull-returning method. +// Check returning nil from a _Nonnull-returning method. @implementation NSFoo -- (void)methodTakingIntPtr:(__nonnull int *)ptr { } -- (__nonnull int *)methodReturningIntPtr { +- (void)methodTakingIntPtr:(_Nonnull int *)ptr { } +- (_Nonnull int *)methodReturningIntPtr { return 0; // no warning } @end @@ -35,15 +35,15 @@ __attribute__((objc_root_class)) - (nonnull NSFoo *)methodWithFoo:(nonnull NSFoo *)foo; - (nonnull NSFoo **)invalidMethod1; // expected-error{{nullability keyword 'nonnull' cannot be applied to multi-level pointer type 'NSFoo **'}} -// expected-note@-1{{use nullability type specifier '__nonnull' to affect the innermost pointer type of 'NSFoo **'}} -- (nonnull NSFoo * __nullable)conflictingMethod1; // expected-error{{nullability specifier '__nullable' conflicts with existing specifier '__nonnull'}} -- (nonnull NSFoo * __nonnull)redundantMethod1; // expected-warning{{duplicate nullability specifier '__nonnull'}} +// expected-note@-1{{use nullability type specifier '_Nonnull' to affect the innermost pointer type of 'NSFoo **'}} +- (nonnull NSFoo * _Nullable)conflictingMethod1; // expected-error{{nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'}} +- (nonnull NSFoo * _Nonnull)redundantMethod1; // expected-warning{{duplicate nullability specifier '_Nonnull'}} @property(nonnull,retain) NSFoo *property1; @property(nullable,assign) NSFoo ** invalidProperty1; // expected-error{{nullability keyword 'nullable' cannot be applied to multi-level pointer type 'NSFoo **'}} -// expected-note@-1{{use nullability type specifier '__nullable' to affect the innermost pointer type of 'NSFoo **'}} -@property(null_unspecified,retain) NSFoo * __nullable conflictingProperty1; // expected-error{{nullability specifier '__nullable' conflicts with existing specifier '__null_unspecified'}} -@property(retain,nonnull) NSFoo * __nonnull redundantProperty1; // expected-warning{{duplicate nullability specifier '__nonnull'}} +// expected-note@-1{{use nullability type specifier '_Nullable' to affect the innermost pointer type of 'NSFoo **'}} +@property(null_unspecified,retain) NSFoo * _Nullable conflictingProperty1; // expected-error{{nullability specifier '_Nullable' conflicts with existing specifier '_Null_unspecified'}} +@property(retain,nonnull) NSFoo * _Nonnull redundantProperty1; // expected-warning{{duplicate nullability specifier '_Nonnull'}} @property(null_unspecified,retain,nullable) NSFoo *conflictingProperty3; // expected-error{{nullability specifier 'nullable' conflicts with existing specifier 'null_unspecified'}} @property(nullable,retain,nullable) NSFoo *redundantProperty3; // expected-warning{{duplicate nullability specifier 'nullable'}} @@ -52,19 +52,19 @@ __attribute__((objc_root_class)) @interface NSBar () @property(nonnull,retain) NSFoo *property2; @property(nullable,assign) NSFoo ** invalidProperty2; // expected-error{{nullability keyword 'nullable' cannot be applied to multi-level pointer type 'NSFoo **'}} -// expected-note@-1{{use nullability type specifier '__nullable' to affect the innermost pointer type of 'NSFoo **'}} -@property(null_unspecified,retain) NSFoo * __nullable conflictingProperty2; // expected-error{{nullability specifier '__nullable' conflicts with existing specifier '__null_unspecified'}} -@property(retain,nonnull) NSFoo * __nonnull redundantProperty2; // expected-warning{{duplicate nullability specifier '__nonnull'}} +// expected-note@-1{{use nullability type specifier '_Nullable' to affect the innermost pointer type of 'NSFoo **'}} +@property(null_unspecified,retain) NSFoo * _Nullable conflictingProperty2; // expected-error{{nullability specifier '_Nullable' conflicts with existing specifier '_Null_unspecified'}} +@property(retain,nonnull) NSFoo * _Nonnull redundantProperty2; // expected-warning{{duplicate nullability specifier '_Nonnull'}} @end -void test_accepts_nonnull_null_pointer_literal(NSFoo *foo, __nonnull NSBar *bar) { +void test_accepts_nonnull_null_pointer_literal(NSFoo *foo, _Nonnull NSBar *bar) { [foo methodTakingIntPtr: 0]; // expected-warning{{null passed to a callee that requires a non-null argument}} [bar methodWithFoo: 0]; // expected-warning{{null passed to a callee that requires a non-null argument}} bar.property1 = 0; // expected-warning{{null passed to a callee that requires a non-null argument}} bar.property2 = 0; // expected-warning{{null passed to a callee that requires a non-null argument}} [bar setProperty1: 0]; // expected-warning{{null passed to a callee that requires a non-null argument}} [bar setProperty2: 0]; // expected-warning{{null passed to a callee that requires a non-null argument}} - int *ptr = bar.property1; // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'NSFoo * __nonnull'}} + int *ptr = bar.property1; // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'NSFoo * _Nonnull'}} } // Check returning nil from a nonnull-returning method. @@ -82,7 +82,7 @@ void test_accepts_nonnull_null_pointer_literal(NSFoo *foo, __nonnull NSBar *bar) } - (NSFoo *)redundantMethod1 { int *ip = 0; - return ip; // expected-warning{{result type 'NSFoo * __nonnull'}} + return ip; // expected-warning{{result type 'NSFoo * _Nonnull'}} } @end @@ -95,8 +95,8 @@ __attribute__((objc_root_class)) @implementation NSMerge - (NSFoo *)methodA:(NSFoo*)foo { - int *ptr = foo; // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'NSFoo * __nonnull'}} - return ptr; // expected-warning{{result type 'NSFoo * __nonnull'}} + int *ptr = foo; // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'NSFoo * _Nonnull'}} + return ptr; // expected-warning{{result type 'NSFoo * _Nonnull'}} } - (nullable NSFoo *)methodB:(null_unspecified NSFoo*)foo { // expected-error{{nullability specifier 'nullable' conflicts with existing specifier 'nonnull'}} \ @@ -106,7 +106,7 @@ __attribute__((objc_root_class)) - (nonnull NSFoo *)methodC:(nullable NSFoo*)foo { int *ip = 0; - return ip; // expected-warning{{result type 'NSFoo * __nonnull'}} + return ip; // expected-warning{{result type 'NSFoo * _Nonnull'}} } @end @@ -119,27 +119,27 @@ __attribute__((objc_root_class)) @end void test_receiver_merge(NSMergeReceiver *none, - __nonnull NSMergeReceiver *nonnull, - __nullable NSMergeReceiver *nullable, - __null_unspecified NSMergeReceiver *null_unspecified) { + _Nonnull NSMergeReceiver *nonnull, + _Nullable NSMergeReceiver *nullable, + _Null_unspecified NSMergeReceiver *null_unspecified) { int *ptr; - ptr = [nullable returnsNullable]; // expected-warning{{'id __nullable'}} - ptr = [nullable returnsNullUnspecified]; // expected-warning{{'id __nullable'}} - ptr = [nullable returnsNonNull]; // expected-warning{{'id __nullable'}} - ptr = [nullable returnsNone]; // expected-warning{{'id __nullable'}} + ptr = [nullable returnsNullable]; // expected-warning{{'id _Nullable'}} + ptr = [nullable returnsNullUnspecified]; // expected-warning{{'id _Nullable'}} + ptr = [nullable returnsNonNull]; // expected-warning{{'id _Nullable'}} + ptr = [nullable returnsNone]; // expected-warning{{'id _Nullable'}} - ptr = [null_unspecified returnsNullable]; // expected-warning{{'id __nullable'}} - ptr = [null_unspecified returnsNullUnspecified]; // expected-warning{{'id __null_unspecified'}} - ptr = [null_unspecified returnsNonNull]; // expected-warning{{'id __null_unspecified'}} + ptr = [null_unspecified returnsNullable]; // expected-warning{{'id _Nullable'}} + ptr = [null_unspecified returnsNullUnspecified]; // expected-warning{{'id _Null_unspecified'}} + ptr = [null_unspecified returnsNonNull]; // expected-warning{{'id _Null_unspecified'}} ptr = [null_unspecified returnsNone]; // expected-warning{{'id'}} - ptr = [nonnull returnsNullable]; // expected-warning{{'id __nullable'}} - ptr = [nonnull returnsNullUnspecified]; // expected-warning{{'id __null_unspecified'}} - ptr = [nonnull returnsNonNull]; // expected-warning{{'id __nonnull'}} + ptr = [nonnull returnsNullable]; // expected-warning{{'id _Nullable'}} + ptr = [nonnull returnsNullUnspecified]; // expected-warning{{'id _Null_unspecified'}} + ptr = [nonnull returnsNonNull]; // expected-warning{{'id _Nonnull'}} ptr = [nonnull returnsNone]; // expected-warning{{'id'}} - ptr = [none returnsNullable]; // expected-warning{{'id __nullable'}} + ptr = [none returnsNullable]; // expected-warning{{'id _Nullable'}} ptr = [none returnsNullUnspecified]; // expected-warning{{'id'}} ptr = [none returnsNonNull]; // expected-warning{{'id'}} ptr = [none returnsNone]; // expected-warning{{'id'}} @@ -157,19 +157,19 @@ __attribute__((objc_root_class)) - (nullable instancetype)returnMe; + (nullable instancetype)returnInstanceOfMe; -- (nonnull instancetype __nullable)initWithBlah2:(nonnull id)blah; // expected-error {{nullability specifier '__nullable' conflicts with existing specifier '__nonnull'}} -- (instancetype __nullable)returnMe2; -+ (__nonnull instancetype)returnInstanceOfMe2; +- (nonnull instancetype _Nullable)initWithBlah2:(nonnull id)blah; // expected-error {{nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'}} +- (instancetype _Nullable)returnMe2; ++ (_Nonnull instancetype)returnInstanceOfMe2; @end -void test_instancetype(InitializableClass * __nonnull ic, id __nonnull object) { - int *ip = [ic returnMe]; // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'InitializableClass * __nullable'}} - ip = [InitializableClass returnMe]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'id __nullable'}} - ip = [InitializableClass returnInstanceOfMe]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'InitializableClass * __nullable'}} - ip = [object returnMe]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'id __nullable'}} +void test_instancetype(InitializableClass * _Nonnull ic, id _Nonnull object) { + int *ip = [ic returnMe]; // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'InitializableClass * _Nullable'}} + ip = [InitializableClass returnMe]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'id _Nullable'}} + ip = [InitializableClass returnInstanceOfMe]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'InitializableClass * _Nullable'}} + ip = [object returnMe]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'id _Nullable'}} - ip = [ic returnMe2]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'InitializableClass * __nullable'}} - ip = [InitializableClass returnInstanceOfMe2]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'InitializableClass * __nonnull'}} + ip = [ic returnMe2]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'InitializableClass * _Nullable'}} + ip = [InitializableClass returnInstanceOfMe2]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'InitializableClass * _Nonnull'}} } // Check null_resettable getters/setters. @@ -184,14 +184,14 @@ __attribute__((objc_root_class)) @end void test_null_resettable(NSResettable *r, int *ip) { - [r setResettable1:ip]; // expected-warning{{incompatible pointer types sending 'int *' to parameter of type 'NSResettable * __nullable'}} - r.resettable1 = ip; // expected-warning{{incompatible pointer types assigning to 'NSResettable * __nullable' from 'int *'}} + [r setResettable1:ip]; // expected-warning{{incompatible pointer types sending 'int *' to parameter of type 'NSResettable * _Nullable'}} + r.resettable1 = ip; // expected-warning{{incompatible pointer types assigning to 'NSResettable * _Nullable' from 'int *'}} } @implementation NSResettable // expected-warning{{synthesized setter 'setResettable4:' for null_resettable property 'resettable4' does not handle nil}} - (NSResettable *)resettable1 { int *ip = 0; - return ip; // expected-warning{{result type 'NSResettable * __nonnull'}} + return ip; // expected-warning{{result type 'NSResettable * _Nonnull'}} } - (void)setResettable1:(NSResettable *)param { @@ -218,15 +218,15 @@ void test_null_resettable(NSResettable *r, int *ip) { void testMultiProp(MultiProp *foo) { int *ip; - ip = foo.a; // expected-warning{{from 'id __nullable'}} - ip = foo.d; // expected-warning{{from 'MultiProp * __nullable'}} - ip = foo.e; // expected-error{{incompatible type 'MultiProp *(^ __nullable)(int)'}} + ip = foo.a; // expected-warning{{from 'id _Nullable'}} + ip = foo.d; // expected-warning{{from 'MultiProp * _Nullable'}} + ip = foo.e; // expected-error{{incompatible type 'MultiProp *(^ _Nullable)(int)'}} } void testBlockLiterals() { (void)(^id(void) { return 0; }); - (void)(^id __nullable (void) { return 0; }); - (void)(^ __nullable id(void) { return 0; }); + (void)(^id _Nullable (void) { return 0; }); + (void)(^ _Nullable id(void) { return 0; }); - int *x = (^ __nullable id(void) { return 0; })(); // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'id __nullable'}} + int *x = (^ _Nullable id(void) { return 0; })(); // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'id _Nullable'}} } diff --git a/clang/test/SemaObjC/nullable-weak-property.m b/clang/test/SemaObjC/nullable-weak-property.m index 617ff4ee5c6..faafd204675 100644 --- a/clang/test/SemaObjC/nullable-weak-property.m +++ b/clang/test/SemaObjC/nullable-weak-property.m @@ -5,7 +5,7 @@ @interface NSObject @end @class NSFoo; -void foo (NSFoo * __nonnull); +void foo (NSFoo * _Nonnull); @interface NSBar : NSObject @property(weak) NSFoo *property1; @@ -13,6 +13,6 @@ void foo (NSFoo * __nonnull); @implementation NSBar - (void) Meth { - foo (self.property1); // expected-warning {{implicit conversion from nullable pointer 'NSFoo * __nullable' to non-nullable pointer type 'NSFoo * __nonnull'}} + foo (self.property1); // expected-warning {{implicit conversion from nullable pointer 'NSFoo * _Nullable' to non-nullable pointer type 'NSFoo * _Nonnull'}} } @end diff --git a/clang/test/SemaObjCXX/Inputs/nullability-consistency-1.h b/clang/test/SemaObjCXX/Inputs/nullability-consistency-1.h index 4d6bf79f9a4..6ab48fe0cd8 100644 --- a/clang/test/SemaObjCXX/Inputs/nullability-consistency-1.h +++ b/clang/test/SemaObjCXX/Inputs/nullability-consistency-1.h @@ -1,6 +1,6 @@ void f1(int *ptr); // expected-warning{{pointer is missing a nullability type specifier}} -void f2(int * __nonnull); +void f2(int * _Nonnull); #include "nullability-consistency-2.h" diff --git a/clang/test/SemaObjCXX/Inputs/nullability-consistency-2.h b/clang/test/SemaObjCXX/Inputs/nullability-consistency-2.h index 8efdfa8394e..4517738c552 100644 --- a/clang/test/SemaObjCXX/Inputs/nullability-consistency-2.h +++ b/clang/test/SemaObjCXX/Inputs/nullability-consistency-2.h @@ -1,4 +1,4 @@ -void g1(int * __nonnull); +void g1(int * _Nonnull); void g2(int (^block)(int, int)); // expected-warning{{block pointer is missing a nullability type specifier}} diff --git a/clang/test/SemaObjCXX/Inputs/nullability-consistency-3.h b/clang/test/SemaObjCXX/Inputs/nullability-consistency-3.h index a0c0d381bb8..520d1a4b344 100644 --- a/clang/test/SemaObjCXX/Inputs/nullability-consistency-3.h +++ b/clang/test/SemaObjCXX/Inputs/nullability-consistency-3.h @@ -1 +1 @@ -void double_declarator1(int *__nonnull *); // expected-warning{{pointer is missing a nullability type specifier (__nonnull, __nullable, or __null_unspecified)}} +void double_declarator1(int *_Nonnull *); // expected-warning{{pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)}} diff --git a/clang/test/SemaObjCXX/Inputs/nullability-consistency-4.h b/clang/test/SemaObjCXX/Inputs/nullability-consistency-4.h index 984280c17eb..ac227a0885b 100644 --- a/clang/test/SemaObjCXX/Inputs/nullability-consistency-4.h +++ b/clang/test/SemaObjCXX/Inputs/nullability-consistency-4.h @@ -1 +1 @@ -void double_declarator1(int * * __nonnull); // expected-warning{{pointer is missing a nullability type specifier (__nonnull, __nullable, or __null_unspecified)}} +void double_declarator1(int * * _Nonnull); // expected-warning{{pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)}} diff --git a/clang/test/SemaObjCXX/Inputs/nullability-consistency-5.h b/clang/test/SemaObjCXX/Inputs/nullability-consistency-5.h index 3a685af614e..1c74ab882a1 100644 --- a/clang/test/SemaObjCXX/Inputs/nullability-consistency-5.h +++ b/clang/test/SemaObjCXX/Inputs/nullability-consistency-5.h @@ -8,7 +8,7 @@ void suppress1(SUPPRESS_NULLABILITY_WARNING(int *) ptr); // no warning void shouldwarn5(int *ptr); //expected-warning{{missing a nullability type specifier}} -void trigger5(int * __nonnull); +void trigger5(int * _Nonnull); void suppress2(SUPPRESS_NULLABILITY_WARNING(int *) ptr); // no warning diff --git a/clang/test/SemaObjCXX/Inputs/nullability-consistency-8.h b/clang/test/SemaObjCXX/Inputs/nullability-consistency-8.h index 890bb4db546..2425a70356d 100644 --- a/clang/test/SemaObjCXX/Inputs/nullability-consistency-8.h +++ b/clang/test/SemaObjCXX/Inputs/nullability-consistency-8.h @@ -1,4 +1,4 @@ -typedef int* __nonnull mynonnull; +typedef int* _Nonnull mynonnull; __attribute__((objc_root_class)) @interface typedefClass @@ -13,15 +13,15 @@ void func3(int *); // expected-warning{{pointer is missing a nullability type sp typedef void *CFTypeRef; void cf1(CFTypeRef * p CF_RETURNS_NOT_RETAINED); // expected-warning {{pointer is missing a nullability type specifier}} -void cf2(CFTypeRef * __nullable p CF_RETURNS_NOT_RETAINED); -void cf3(CFTypeRef * __nonnull p CF_RETURNS_NOT_RETAINED); +void cf2(CFTypeRef * _Nullable p CF_RETURNS_NOT_RETAINED); +void cf3(CFTypeRef * _Nonnull p CF_RETURNS_NOT_RETAINED); -void cf4(CFTypeRef __nullable * __nullable p CF_RETURNS_NOT_RETAINED); -void cf5(CFTypeRef __nonnull * __nullable p CF_RETURNS_NOT_RETAINED); +void cf4(CFTypeRef _Nullable * _Nullable p CF_RETURNS_NOT_RETAINED); +void cf5(CFTypeRef _Nonnull * _Nullable p CF_RETURNS_NOT_RETAINED); -void cf6(CFTypeRef * __nullable CF_RETURNS_NOT_RETAINED p); -void cf7(CF_RETURNS_NOT_RETAINED CFTypeRef * __nonnull p); +void cf6(CFTypeRef * _Nullable CF_RETURNS_NOT_RETAINED p); +void cf7(CF_RETURNS_NOT_RETAINED CFTypeRef * _Nonnull p); -typedef CFTypeRef __nullable *CFTypeRefPtr; +typedef CFTypeRef _Nullable *CFTypeRefPtr; void cfp1(CFTypeRefPtr p CF_RETURNS_NOT_RETAINED); // expected-warning {{pointer is missing a nullability type specifier}} -void cfp2(CFTypeRefPtr __nonnull p CF_RETURNS_NOT_RETAINED); +void cfp2(CFTypeRefPtr _Nonnull p CF_RETURNS_NOT_RETAINED); diff --git a/clang/test/SemaObjCXX/Inputs/nullability-consistency-system/nullability-consistency-system.h b/clang/test/SemaObjCXX/Inputs/nullability-consistency-system/nullability-consistency-system.h index 6dbca1663d5..9161af1cf35 100644 --- a/clang/test/SemaObjCXX/Inputs/nullability-consistency-system/nullability-consistency-system.h +++ b/clang/test/SemaObjCXX/Inputs/nullability-consistency-system/nullability-consistency-system.h @@ -5,4 +5,4 @@ void system1(int *ptr); // expected-warning@-2{{pointer is missing a nullability type specifier}} #endif -void system2(int * __nonnull); +void system2(int * _Nonnull); diff --git a/clang/test/SemaObjCXX/Inputs/nullability-pragmas-1.h b/clang/test/SemaObjCXX/Inputs/nullability-pragmas-1.h index 95011169241..4ac813d9961 100644 --- a/clang/test/SemaObjCXX/Inputs/nullability-pragmas-1.h +++ b/clang/test/SemaObjCXX/Inputs/nullability-pragmas-1.h @@ -25,19 +25,19 @@ void f3(A* obj); void f4(int (^block)(int, int)); void f5(int_ptr x); void f6(A_ptr obj); -void f7(int * __nullable x); -void f8(A * __nullable obj); +void f7(int * _Nullable x); +void f8(A * _Nullable obj); void f9(int X::* mem_ptr); void f10(int (X::*mem_func)(int, int)); -void f11(int X::* __nullable mem_ptr); -void f12(int (X::* __nullable mem_func)(int, int)); +void f11(int X::* _Nullable mem_ptr); +void f12(int (X::* _Nullable mem_func)(int, int)); int_ptr f13(void); A *f14(void); -int * __null_unspecified f15(void); -A * __null_unspecified f16(void); -void f17(CFErrorRef *error); // expected-note{{no known conversion from 'A * __nonnull' to 'CFErrorRef __nullable * __nullable' (aka '__CFError **') for 1st argument}} +int * _Null_unspecified f15(void); +A * _Null_unspecified f16(void); +void f17(CFErrorRef *error); // expected-note{{no known conversion from 'A * _Nonnull' to 'CFErrorRef _Nullable * _Nullable' (aka '__CFError **') for 1st argument}} void f18(A **); // expected-warning 2{{pointer is missing a nullability type specifier}} void f19(CFErrorRefPtr error); // expected-warning{{pointer is missing a nullability type specifier}} @@ -64,14 +64,14 @@ void g5(int (**fp)(int, int)); // expected-warning 2{{pointer is missing a nulla int *global_int_ptr; -// typedefs not inferred __nonnull +// typedefs not inferred _Nonnull typedef int *int_ptr_2; typedef int * // expected-warning{{pointer is missing a nullability type specifier}} *int_ptr_ptr; static inline void f30(void) { - float *fp = global_int_ptr; // expected-error{{cannot initialize a variable of type 'float *' with an lvalue of type 'int * __nonnull'}} + float *fp = global_int_ptr; // expected-error{{cannot initialize a variable of type 'float *' with an lvalue of type 'int * _Nonnull'}} int_ptr_2 ip2; float *fp2 = ip2; // expected-error{{cannot initialize a variable of type 'float *' with an lvalue of type 'int_ptr_2' (aka 'int *')}} @@ -83,7 +83,7 @@ static inline void f30(void) { @interface AA : A { @public id ivar1; - __nonnull id ivar2; + _Nonnull id ivar2; } @end @@ -92,8 +92,8 @@ static inline void f30(void) { void f20(A *a); // expected-warning{{pointer is missing a nullability type specifier}} void f21(int_ptr x); // expected-warning{{pointer is missing a nullability type specifier}} void f22(A_ptr y); // expected-warning{{pointer is missing a nullability type specifier}} -void f23(int_ptr __nullable x); -void f24(A_ptr __nullable y); +void f23(int_ptr _Nullable x); +void f24(A_ptr _Nullable y); void f25(int_ptr_2 x); // expected-warning{{pointer is missing a nullability type specifier}} @interface A(OutsidePragmas1) diff --git a/clang/test/SemaObjCXX/nullability-consistency.mm b/clang/test/SemaObjCXX/nullability-consistency.mm index acb972da0b8..6921d8b9d3d 100644 --- a/clang/test/SemaObjCXX/nullability-consistency.mm +++ b/clang/test/SemaObjCXX/nullability-consistency.mm @@ -13,4 +13,4 @@ void h1(int *ptr) { } // don't warn -void h2(int * __nonnull) { } +void h2(int * _Nonnull) { } diff --git a/clang/test/SemaObjCXX/nullability-pragmas.mm b/clang/test/SemaObjCXX/nullability-pragmas.mm index 0c61a30b333..2047fd9e0e7 100644 --- a/clang/test/SemaObjCXX/nullability-pragmas.mm +++ b/clang/test/SemaObjCXX/nullability-pragmas.mm @@ -7,7 +7,7 @@ # error assume_nonnull feature is not set #endif -void test_pragmas_1(A * __nonnull a, AA * __nonnull aa) { +void test_pragmas_1(A * _Nonnull a, AA * _Nonnull aa) { f1(0); // okay: no nullability annotations f2(0); // expected-warning{{null passed to a callee that requires a non-null argument}} f3(0); // expected-warning{{null passed to a callee that requires a non-null argument}} @@ -23,19 +23,19 @@ void test_pragmas_1(A * __nonnull a, AA * __nonnull aa) { [a method1:0]; // expected-warning{{null passed to a callee that requires a non-null argument}} f17(a); // expected-error{{no matching function for call to 'f17'}} - [a method3: a]; // expected-error{{cannot initialize a parameter of type 'NSError * __nullable * __nullable' with an lvalue of type 'A * __nonnull'}} - [a method4: a]; // expected-error{{cannot initialize a parameter of type 'NSErrorPtr __nullable * __nullable' (aka 'NSError **') with an lvalue of type 'A * __nonnull'}} + [a method3: a]; // expected-error{{cannot initialize a parameter of type 'NSError * _Nullable * _Nullable' with an lvalue of type 'A * _Nonnull'}} + [a method4: a]; // expected-error{{cannot initialize a parameter of type 'NSErrorPtr _Nullable * _Nullable' (aka 'NSError **') with an lvalue of type 'A * _Nonnull'}} float *ptr; - ptr = f13(); // expected-error{{assigning to 'float *' from incompatible type 'int_ptr __nonnull' (aka 'int *')}} - ptr = f14(); // expected-error{{assigning to 'float *' from incompatible type 'A * __nonnull'}} - ptr = [a method1:a]; // expected-error{{assigning to 'float *' from incompatible type 'A * __nonnull'}} - ptr = a.aProp; // expected-error{{assigning to 'float *' from incompatible type 'A * __nonnull'}} - ptr = global_int_ptr; // expected-error{{assigning to 'float *' from incompatible type 'int * __nonnull'}} - ptr = f15(); // expected-error{{assigning to 'float *' from incompatible type 'int * __null_unspecified'}} - ptr = f16(); // expected-error{{assigning to 'float *' from incompatible type 'A * __null_unspecified'}} - ptr = [a method2]; // expected-error{{assigning to 'float *' from incompatible type 'A * __null_unspecified'}} + ptr = f13(); // expected-error{{assigning to 'float *' from incompatible type 'int_ptr _Nonnull' (aka 'int *')}} + ptr = f14(); // expected-error{{assigning to 'float *' from incompatible type 'A * _Nonnull'}} + ptr = [a method1:a]; // expected-error{{assigning to 'float *' from incompatible type 'A * _Nonnull'}} + ptr = a.aProp; // expected-error{{assigning to 'float *' from incompatible type 'A * _Nonnull'}} + ptr = global_int_ptr; // expected-error{{assigning to 'float *' from incompatible type 'int * _Nonnull'}} + ptr = f15(); // expected-error{{assigning to 'float *' from incompatible type 'int * _Null_unspecified'}} + ptr = f16(); // expected-error{{assigning to 'float *' from incompatible type 'A * _Null_unspecified'}} + ptr = [a method2]; // expected-error{{assigning to 'float *' from incompatible type 'A * _Null_unspecified'}} ptr = aa->ivar1; // expected-error{{from incompatible type 'id'}} - ptr = aa->ivar2; // expected-error{{from incompatible type 'id __nonnull'}} + ptr = aa->ivar2; // expected-error{{from incompatible type 'id _Nonnull'}} } |