diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Frontend/macro_defined_type.cpp | 15 | ||||
-rw-r--r-- | clang/test/Sema/address_space_print_macro.c | 67 | ||||
-rw-r--r-- | clang/test/Sema/address_spaces.c | 2 | ||||
-rw-r--r-- | clang/test/SemaObjC/externally-retained.m | 6 | ||||
-rw-r--r-- | clang/test/SemaObjC/gc-attributes.m | 4 | ||||
-rw-r--r-- | clang/test/SemaObjC/mrc-weak.m | 2 | ||||
-rw-r--r-- | clang/test/SemaObjCXX/gc-attributes.mm | 4 |
7 files changed, 6 insertions, 94 deletions
diff --git a/clang/test/Frontend/macro_defined_type.cpp b/clang/test/Frontend/macro_defined_type.cpp deleted file mode 100644 index 4e60c840382..00000000000 --- a/clang/test/Frontend/macro_defined_type.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s - -#define NODEREF __attribute__((noderef)) - -void Func() { - int NODEREF i; // expected-warning{{'noderef' can only be used on an array or pointer type}} - int NODEREF *i_ptr; - - // There should be no difference whether a macro defined type is used or not. - auto __attribute__((noderef)) *auto_i_ptr = i_ptr; - auto __attribute__((noderef)) auto_i = i; // expected-warning{{'noderef' can only be used on an array or pointer type}} - - auto NODEREF *auto_i_ptr2 = i_ptr; - auto NODEREF auto_i2 = i; // expected-warning{{'noderef' can only be used on an array or pointer type}} -} diff --git a/clang/test/Sema/address_space_print_macro.c b/clang/test/Sema/address_space_print_macro.c deleted file mode 100644 index 9557149d7c7..00000000000 --- a/clang/test/Sema/address_space_print_macro.c +++ /dev/null @@ -1,67 +0,0 @@ -// RUN: %clang_cc1 %s -fsyntax-only -verify - -#define AS1 __attribute__((address_space(1))) -#define AS2 __attribute__((address_space(2), annotate("foo"))) -#define AS_ND __attribute__((address_space(2), noderef)) - -#define AS(i) address_space(i) -#define AS3 __attribute__((AS(3))) -#define AS5 __attribute__((address_space(5))) char - -void normal_case() { - int *p = 0; - __attribute__((address_space(1))) int *q = p; // expected-error{{initializing '__attribute__((address_space(1))) int *' with an expression of type 'int *' changes address space of pointer}} -} - -char *cmp(AS1 char *x, AS2 char *y) { - return x < y ? x : y; // expected-error{{conditional operator with the second and third operands of type ('AS1 char *' and 'AS2 char *') which are pointers to non-overlapping address spaces}} -} - -__attribute__((address_space(1))) char test_array[10]; -void test3(void) { - extern void test3_helper(char *p); // expected-note{{passing argument to parameter 'p' here}} - test3_helper(test_array); // expected-error{{passing '__attribute__((address_space(1))) char *' to parameter of type 'char *' changes address space of pointer}} -} - -char AS2 *test4_array; -void test4(void) { - extern void test3_helper(char *p); // expected-note{{passing argument to parameter 'p' here}} - test3_helper(test4_array); // expected-error{{passing 'AS2 char *' to parameter of type 'char *' changes address space of pointer}} -} - -void func() { - char AS1 *x; - char AS3 *x2; - AS5 *x3; - char *y; - y = x; // expected-error{{assigning 'AS1 char *' to 'char *' changes address space of pointer}} - y = x2; // expected-error{{assigning 'AS3 char *' to 'char *' changes address space of pointer}} - y = x3; // expected-error{{assigning '__attribute__((address_space(5))) char *' to 'char *' changes address space of pointer}} -} - -void multiple_attrs(AS_ND int *x) { - __attribute__((address_space(2))) int *y = x; // expected-warning{{casting to dereferenceable pointer removes 'noderef' attribute}} -} - -void override_macro_name() { -#define ATTRS __attribute__((noderef)) // expected-note{{previous definition is here}} - ATTRS -#define ATTRS __attribute__((address_space(1))) // expected-warning{{'ATTRS' macro redefined}} - ATTRS - int *x; - - int AS_ND *y = x; // expected-error{{initializing 'AS_ND int *' with an expression of type 'ATTRS int *' changes address space of pointer}} -} - -void partial_macro_declaration() { -#define ATTRS2 __attribute__((noderef)) - ATTRS2 __attribute__((address_space(1))) int *x; - - int AS_ND *y = x; // expected-error{{initializing 'AS_ND int *' with an expression of type 'ATTRS2 int __attribute__((address_space(1))) *' changes address space of pointer}} - - // The attribute not wrapped with a macro should be printed regularly. -#define ATTRS3 __attribute__((address_space(1))) - ATTRS3 __attribute__((noderef)) int *x2; - - int AS_ND *y2 = x2; // expected-error{{initializing 'AS_ND int *' with an expression of type 'ATTRS3 int * __attribute__((noderef))' changes address space of pointer}} -} diff --git a/clang/test/Sema/address_spaces.c b/clang/test/Sema/address_spaces.c index 5425ef75b64..a9046d86f18 100644 --- a/clang/test/Sema/address_spaces.c +++ b/clang/test/Sema/address_spaces.c @@ -71,7 +71,7 @@ __attribute__((address_space("12"))) int *i; // expected-error {{'address_space' // Clang extension doesn't forbid operations on pointers to different address spaces. char* cmp(_AS1 char *x, _AS2 char *y) { - return x < y ? x : y; // expected-error{{conditional operator with the second and third operands of type ('_AS1 char *' and '_AS2 char *') which are pointers to non-overlapping address spaces}} + return x < y ? x : y; // expected-error{{conditional operator with the second and third operands of type ('__attribute__((address_space(1))) char *' and '__attribute__((address_space(2))) char *') which are pointers to non-overlapping address spaces}} } struct SomeStruct { diff --git a/clang/test/SemaObjC/externally-retained.m b/clang/test/SemaObjC/externally-retained.m index 24c531ccf73..2708fc8eefe 100644 --- a/clang/test/SemaObjC/externally-retained.m +++ b/clang/test/SemaObjC/externally-retained.m @@ -68,12 +68,6 @@ void (^blk)(ObjCTy *, ObjCTy *) = second = 0; // expected-error{{variable declared with 'objc_externally_retained' cannot be modified in ARC}} }; -void (^blk2)(ObjCTy *, ObjCTy *) = - ^(__strong ObjCTy *first, ObjCTy *second) __attribute__((objc_externally_retained)) { - first = 0; - second = 0; // expected-error{{variable declared with 'objc_externally_retained' cannot be modified in ARC}} -}; - void test8(EXT_RET ObjCTy *x) {} // expected-warning{{'objc_externally_retained' attribute only applies to variables}} #pragma clang attribute ext_ret.push(__attribute__((objc_externally_retained)), apply_to=any(function, block, objc_method)) diff --git a/clang/test/SemaObjC/gc-attributes.m b/clang/test/SemaObjC/gc-attributes.m index 8bc5c6af33b..1023ba6eec3 100644 --- a/clang/test/SemaObjC/gc-attributes.m +++ b/clang/test/SemaObjC/gc-attributes.m @@ -9,7 +9,7 @@ void test_f0() { A *a; static __weak A *a2; f0(&a); - f0(&a2); // expected-warning{{passing 'A *__weak *' to parameter of type 'A *__strong *' discards qualifiers}} + f0(&a2); // expected-warning{{passing 'A *__weak *' to parameter of type 'A *__strong *' discards qualifiers}} } void f1(__weak A**); // expected-note{{passing argument to parameter here}} @@ -18,7 +18,7 @@ void test_f1() { A *a; __strong A *a2; f1(&a); - f1(&a2); // expected-warning{{passing 'A *__strong *' to parameter of type 'A *__weak *' discards qualifiers}} + f1(&a2); // expected-warning{{passing 'A *__strong *' to parameter of type 'A *__weak *' discards qualifiers}} } // These qualifiers should silently expand to nothing in GC mode. diff --git a/clang/test/SemaObjC/mrc-weak.m b/clang/test/SemaObjC/mrc-weak.m index af7081b53f8..e961e0ab75e 100644 --- a/clang/test/SemaObjC/mrc-weak.m +++ b/clang/test/SemaObjC/mrc-weak.m @@ -62,6 +62,6 @@ void test_unsafe_unretained_cast(id *value) { void test_cast_qualifier_inference(__weak id *value) { __weak id *a = (id*) value; - __unsafe_unretained id *b = (id *)value; // expected-error {{initializing '__unsafe_unretained id *' with an expression of type '__weak id *' changes retain/release properties of pointer}} + __unsafe_unretained id *b = (id*) value; // expected-error {{initializing 'id *' with an expression of type '__weak id *' changes retain/release properties of pointer}} } diff --git a/clang/test/SemaObjCXX/gc-attributes.mm b/clang/test/SemaObjCXX/gc-attributes.mm index ac5ee74c5fd..4549683bb2e 100644 --- a/clang/test/SemaObjCXX/gc-attributes.mm +++ b/clang/test/SemaObjCXX/gc-attributes.mm @@ -3,7 +3,7 @@ @interface A @end -void f0(__strong A **); // expected-note{{candidate function not viable: 1st argument ('A *__weak *') has __weak ownership, but parameter has __strong ownership}} +void f0(__strong A**); // expected-note{{candidate function not viable: 1st argument ('A *__weak *') has __weak ownership, but parameter has __strong ownership}} void test_f0() { A *a; @@ -12,7 +12,7 @@ void test_f0() { f0(&a2); // expected-error{{no matching function}} } -void f1(__weak A **); // expected-note{{candidate function not viable: 1st argument ('A *__strong *') has __strong ownership, but parameter has __weak ownership}} +void f1(__weak A**); // expected-note{{candidate function not viable: 1st argument ('A *__strong *') has __strong ownership, but parameter has __weak ownership}} void test_f1() { A *a; |