aboutsummaryrefslogtreecommitdiff
path: root/test/SemaObjC
diff options
context:
space:
mode:
authorLeonard Chan <leonardchan@google.com>2019-05-02 20:38:14 +0000
committerLeonard Chan <leonardchan@google.com>2019-05-02 20:38:14 +0000
commitfae4e4715c9bc8ceb9b3714d5c08813363890b7f (patch)
tree8994356a0cce2feee0f0cd07cc2ebc180c7fe81c /test/SemaObjC
parentc1150d547616902e07d68c5b51f466bac8ff1883 (diff)
[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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359826 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaObjC')
-rw-r--r--test/SemaObjC/externally-retained.m6
-rw-r--r--test/SemaObjC/gc-attributes.m4
-rw-r--r--test/SemaObjC/mrc-weak.m2
3 files changed, 9 insertions, 3 deletions
diff --git a/test/SemaObjC/externally-retained.m b/test/SemaObjC/externally-retained.m
index 2708fc8eef..24c531ccf7 100644
--- a/test/SemaObjC/externally-retained.m
+++ b/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/test/SemaObjC/gc-attributes.m b/test/SemaObjC/gc-attributes.m
index 1023ba6eec..8bc5c6af33 100644
--- a/test/SemaObjC/gc-attributes.m
+++ b/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/test/SemaObjC/mrc-weak.m b/test/SemaObjC/mrc-weak.m
index e961e0ab75..af7081b53f 100644
--- a/test/SemaObjC/mrc-weak.m
+++ b/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}}
}