diff options
| author | Leonard Chan <leonardchan@google.com> | 2019-05-02 20:38:14 +0000 |
|---|---|---|
| committer | Leonard Chan <leonardchan@google.com> | 2019-05-02 20:38:14 +0000 |
| commit | fc40cbd9d8c63e65eed3590ba925321afe782e1d (patch) | |
| tree | a98067aca61c26511d17adffdc19f7acaeece7ae /clang/test/SemaObjC | |
| parent | 206bc17ea0f522fa0a5939991796fc3ce814d01d (diff) | |
| download | bcm5719-llvm-fc40cbd9d8c63e65eed3590ba925321afe782e1d.tar.gz bcm5719-llvm-fc40cbd9d8c63e65eed3590ba925321afe782e1d.zip | |
[Attribute/Diagnostics] Print macro if definition is an attribute declaration
If an address_space attribute is defined in a macro, print the macro instead
when diagnosing a warning or error for incompatible pointers with different
address_spaces.
We allow this for all attributes (not just address_space), and for multiple
attributes declared in the same macro.
Differential Revision: https://reviews.llvm.org/D51329
llvm-svn: 359826
Diffstat (limited to 'clang/test/SemaObjC')
| -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 |
3 files changed, 9 insertions, 3 deletions
diff --git a/clang/test/SemaObjC/externally-retained.m b/clang/test/SemaObjC/externally-retained.m index 2708fc8eefe..24c531ccf73 100644 --- a/clang/test/SemaObjC/externally-retained.m +++ b/clang/test/SemaObjC/externally-retained.m @@ -68,6 +68,12 @@ 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 1023ba6eec3..8bc5c6af33b 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 e961e0ab75e..af7081b53f8 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 'id *' with an expression of type '__weak id *' changes retain/release properties of pointer}} + __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}} } |

