diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/ARCMT/cxx-checking.mm | 27 | ||||
-rw-r--r-- | clang/test/SemaObjCXX/arc-non-pod.mm | 2 | ||||
-rw-r--r-- | clang/test/SemaObjCXX/arc-object-init-destroy.mm | 52 |
3 files changed, 12 insertions, 69 deletions
diff --git a/clang/test/ARCMT/cxx-checking.mm b/clang/test/ARCMT/cxx-checking.mm index 9f9e3d86431..2f5d5d51655 100644 --- a/clang/test/ARCMT/cxx-checking.mm +++ b/clang/test/ARCMT/cxx-checking.mm @@ -1,16 +1,16 @@ -// RUN: %clang_cc1 -arcmt-check -verify -triple x86_64-apple-darwin10 -fsyntax-only -fblocks -Warc-abi %s +// RUN: %clang_cc1 -arcmt-check -verify -triple x86_64-apple-darwin10 -fsyntax-only -fblocks %s // DISABLE: mingw32 // Classes that have an Objective-C object pointer. -struct HasObjectMember0 { // expected-warning{{'HasObjectMember0' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}} +struct HasObjectMember0 { id x; }; -struct HasObjectMember1 { // expected-warning{{'HasObjectMember1' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}} +struct HasObjectMember1 { id x[3]; }; -struct HasObjectMember2 { // expected-warning{{'HasObjectMember2' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}} +struct HasObjectMember2 { id x[3][2]; }; @@ -27,11 +27,11 @@ struct HasObjectMember3 { __unsafe_unretained id x[3][2]; }; -struct HasBlockPointerMember0 { // expected-warning{{'HasBlockPointerMember0' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}} +struct HasBlockPointerMember0 { int (^bp)(int); }; -struct HasBlockPointerMember1 { // expected-warning{{'HasBlockPointerMember1' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}} +struct HasBlockPointerMember1 { int (^bp[2][3])(int); }; @@ -39,20 +39,17 @@ struct NonPOD { NonPOD(const NonPOD&); }; -struct HasObjectMemberAndNonPOD0 { // expected-warning{{'HasObjectMemberAndNonPOD0' cannot be shared between ARC and non-ARC code; add a non-trivial copy assignment operator to make it ABI-compatible}} \ - // expected-warning{{'HasObjectMemberAndNonPOD0' cannot be shared between ARC and non-ARC code; add a non-trivial destructor to make it ABI-compatible}} +struct HasObjectMemberAndNonPOD0 { id x; NonPOD np; }; -struct HasObjectMemberAndNonPOD1 { // expected-warning{{'HasObjectMemberAndNonPOD1' cannot be shared between ARC and non-ARC code; add a non-trivial copy assignment operator to make it ABI-compatible}} \ - // expected-warning{{'HasObjectMemberAndNonPOD1' cannot be shared between ARC and non-ARC code; add a non-trivial destructor to make it ABI-compatible}} +struct HasObjectMemberAndNonPOD1 { NonPOD np; id x[3]; }; -struct HasObjectMemberAndNonPOD2 { // expected-warning{{'HasObjectMemberAndNonPOD2' cannot be shared between ARC and non-ARC code; add a non-trivial copy assignment operator to make it ABI-compatible}} \ - // expected-warning{{'HasObjectMemberAndNonPOD2' cannot be shared between ARC and non-ARC code; add a non-trivial destructor to make it ABI-compatible}} +struct HasObjectMemberAndNonPOD2 { NonPOD np; id x[3][2]; }; @@ -64,14 +61,12 @@ struct HasObjectMemberAndNonPOD3 { id x[3][2]; }; -struct HasBlockPointerMemberAndNonPOD0 { // expected-warning{{'HasBlockPointerMemberAndNonPOD0' cannot be shared between ARC and non-ARC code; add a non-trivial copy assignment operator to make it ABI-compatible}} \ -// expected-warning{{'HasBlockPointerMemberAndNonPOD0' cannot be shared between ARC and non-ARC code; add a non-trivial destructor to make it ABI-compatible}} +struct HasBlockPointerMemberAndNonPOD0 { NonPOD np; int (^bp)(int); }; -struct HasBlockPointerMemberAndNonPOD1 { // expected-warning{{'HasBlockPointerMemberAndNonPOD1' cannot be shared between ARC and non-ARC code; add a non-trivial copy assignment operator to make it ABI-compatible}} \ -// expected-warning{{'HasBlockPointerMemberAndNonPOD1' cannot be shared between ARC and non-ARC code; add a non-trivial destructor to make it ABI-compatible}} +struct HasBlockPointerMemberAndNonPOD1 { NonPOD np; int (^bp[2][3])(int); }; diff --git a/clang/test/SemaObjCXX/arc-non-pod.mm b/clang/test/SemaObjCXX/arc-non-pod.mm index 1c5cf7af3a1..9eecb7ecf0e 100644 --- a/clang/test/SemaObjCXX/arc-non-pod.mm +++ b/clang/test/SemaObjCXX/arc-non-pod.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -Warc-abi -verify -fblocks -triple x86_64-apple-darwin10.0.0 %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -verify -fblocks -triple x86_64-apple-darwin10.0.0 %s // Classes that have an Objective-C object pointer. struct HasObjectMember0 { // expected-warning{{'HasObjectMember0' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}} diff --git a/clang/test/SemaObjCXX/arc-object-init-destroy.mm b/clang/test/SemaObjCXX/arc-object-init-destroy.mm deleted file mode 100644 index e10e3eac9fc..00000000000 --- a/clang/test/SemaObjCXX/arc-object-init-destroy.mm +++ /dev/null @@ -1,52 +0,0 @@ -// RUN: %clang_cc1 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify -Warc-abi -fblocks -triple x86_64-apple-darwin10.0.0 %s - -typedef __strong id strong_id; -typedef __weak id weak_id; -void test_pseudo_destructors(__strong id *sptr, __weak id *wptr) { - sptr->~id(); // okay - wptr->~id(); // okay - sptr->~strong_id(); // okay - wptr->~weak_id(); - sptr->~weak_id(); // expected-error{{pseudo-destructor destroys object of type '__strong id' with inconsistently-qualified type 'weak_id' (aka '__weak id')}} - wptr->strong_id::~strong_id(); // expected-error{{pseudo-destructor destroys object of type '__weak id' with inconsistently-qualified type 'strong_id' (aka '__strong id')}} - - sptr->id::~id(); // okay - wptr->id::~id(); // okay -} - -void test_delete(__strong id *sptr, __weak id *wptr) { - delete sptr; - delete wptr; - delete [] sptr; // expected-warning{{destroying an array of '__strong id'; this array must not have been allocated from non-ARC code}} - delete [] wptr; // expected-warning{{destroying an array of '__weak id'; this array must not have been allocated from non-ARC code}} -} - -void test_new(int n) { - (void)new strong_id; - (void)new weak_id; - (void)new strong_id [n]; // expected-warning{{allocating an array of 'strong_id' (aka '__strong id'); this array must not be deleted in non-ARC code}} - (void)new weak_id [n]; // expected-warning{{allocating an array of 'weak_id' (aka '__weak id'); this array must not be deleted in non-ARC code}} - - (void)new __strong id; - (void)new __weak id; - (void)new __strong id [n]; // expected-warning{{allocating an array of '__strong id'; this array must not be deleted in non-ARC code}} - - // Infer '__strong'. - __strong id *idptr = new id; - __strong id *idptr2 = new id [n]; // expected-warning{{allocating an array of '__strong id'; this array must not be deleted in non-ARC code}} - - // ... but not for arrays. - typedef id id_array[2][3]; - (void)new id_array; // expected-error{{'new' cannot allocate an array of 'id' with no explicit ownership}} - - typedef __strong id strong_id_array[2][3]; - typedef __strong id strong_id_3[3]; - strong_id_3 *idptr3 = new strong_id_array; // expected-warning{{allocating an array of '__strong id'; this array must not be deleted in non-ARC code}} -} - -void test_jump_scope() { - goto done; // expected-error{{goto into protected scope}} - __strong id x; // expected-note{{jump bypasses initialization of retaining variable}} - done: - return; -} |