summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaObjC/arc.m
Commit message (Collapse)AuthorAgeFilesLines
...
* Clean up the analysis of the collection operand to ObjCJohn McCall2011-07-271-0/+7
| | | | | | | | | | | for-in statements; specifically, make sure to close over any temporaries or cleanups it might require. In ARC, this has implications for the lifetime of the collection, so emit it with a retain and release it upon exit from the loop. rdar://problem/9817306 llvm-svn: 136204
* In ARC we emit an error when compiling:Argyrios Kyrtzidis2011-07-261-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | @interface Foo : NSObject @property (readonly) id myProp; @end @implementation Foo @synthesize myProp; @end t.m:9:13: error: ARC forbids synthesizing a property of an Objective-C object with unspecified storage attribute @synthesize myProp; ^ which is fine, we want the ownership of the synthesized ivar to be explicit. But we should _not_ emit an error for the following cases, because we can get the ownership either from the declared ivar or from the property type: @interface Foo : NSObject { __weak id _myProp1; id myProp2; } @property (readonly) id myProp1; @property (readonly) id myProp2; @property (readonly) __strong id myProp3; @end @implementation Foo @synthesize myProp1 = _myProp1; @synthesize myProp2; @synthesize myProp3; @end  rdar://9844006. llvm-svn: 136155
* objective-c: Any use of @synthesize or @dynamic lexically after a method (or ↵Fariborz Jahanian2011-07-221-2/+2
| | | | | | | | | | C function) implementation will be rejected with a compilation error in ARC mode, and a compiler warning otherwise. This may cause breakage in non-arc (and arc) tests which don't expect warning/error. Feel free to fix the tests, or reverse the patch, if I am unavailable. // rdar://9818354 - WIP llvm-svn: 135740
* In ARC mode, consider Objective-C lifetime types (object pointers andDouglas Gregor2011-07-121-0/+8
| | | | | | | | | | | | | | block pointers) that don't have any qualification to be POD types. We were previously considering them to be non-POD types, because this was convenient in C++ for is_pod-like traits. However, we now end up inferring lifetime in such cases (template arguments infer __strong), so it is not necessary. Moreover, we want rvalues of object type (which have their lifetime stripped) to be PODs to allow, e.g., va_arg(arglist, id) to function properly. Fixes <rdar://problem/9758798>. llvm-svn: 134993
* [ARC] Complain about property without storage attribute when @synthesizing ↵Argyrios Kyrtzidis2011-07-121-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | it, not at its declaration. For this sample: @interface Foo @property id x; @end we get: t.m:2:1: error: ARC forbids properties of Objective-C objects with unspecified storage attribute @property id x; ^ 1 error generated. The error should be imposed on the implementor of the interface, not the user. If the user uses a header of a non-ARC library whose source code he does not have, we are basically asking him to go change the header of the library (bad in general), possible overriding how the property is implemented if he gets confused and says "Oh I'll just add 'copy' then" (even worse). Second issue is that we don't emit any error for 'readonly' properties, e.g: @interface Foo @property (readonly) id x; // no error here @end @implementation Foo @synthesize x; // no error here too @end We should give an error when the implementor is @synthesizing a property which doesn't have any storage specifier; this is when the explicit specifier is important, because we are going to create an ivar and we want its ownership to be explicit. Related improvements: -OBJC_PR_unsafe_unretained turned out to not fit in ObjCPropertyDecl's bitfields, fix it. -For properties of extension classes don't drop PropertyAttributesAsWritten values. -Have PropertyAttributesAsWritten actually only reflect what the user wrote rdar://9756610. llvm-svn: 134960
* Change the driver's logic about Objective-C runtimes: abstract out aJohn McCall2011-07-061-1/+1
| | | | | | | | | | | | structure to hold inferred information, then propagate each invididual bit down to -cc1. Separate the bits of "supports weak" and "has a native ARC runtime"; make the latter a CodeGenOption. The tool chain is still driving this decision, because it's the place that has the required deployment target information on Darwin, but at least it's better-factored now. llvm-svn: 134453
* Fix the warning that is emitted when an ownership attribute is applied ↵Argyrios Kyrtzidis2011-07-011-0/+2
| | | | | | incorrectly. llvm-svn: 134278
* ARC writeback isn't supposed to apply to local indirect pointers,John McCall2011-06-271-0/+13
| | | | | | only to pointers to locals. But it should work inside blocks, too. llvm-svn: 133969
* objc-arc/mrc: Allow ns_returns_not_retained attribute on propertiesFariborz Jahanian2011-06-251-0/+20
| | | | | | | | | to turn off warning on those properties which follow Cocoa naming convention for retaining objects and yet they were not meant for such purposes. Also, perform consistancy checking for declared getters of such methods. // rdar://9636091 llvm-svn: 133849
* objc-arc: Check on a variety of unsafe assignment of retained Fariborz Jahanian2011-06-241-2/+2
| | | | | | objects. // rdar://9495837 llvm-svn: 133806
* Rename objc_lifetime -> objc_ownership, and modify diagnostics to talk about ↵Argyrios Kyrtzidis2011-06-241-12/+12
| | | | | | | | 'ownership', not 'lifetime'. rdar://9477613. llvm-svn: 133779
* Change "cannot assign retained object.." warning to "assigning retained ↵Argyrios Kyrtzidis2011-06-221-4/+4
| | | | | | object.." llvm-svn: 133625
* objc-arc: Allow unbridged cast of retainable object toFariborz Jahanian2011-06-221-0/+9
| | | | | | | integral as it is not transferring ownership.. // rdar://9619861 llvm-svn: 133622
* Objective-C fast enumeration loop variables are not retained in ARC, butJohn McCall2011-06-171-1/+1
| | | | | | | | | | | | they should still be officially __strong for the purposes of errors, block capture, etc. Make a new bit on variables, isARCPseudoStrong(), and set this for 'self' and these enumeration-loop variables. Change the code that was looking for the old patterns to look for this bit, and change IR generation to find this bit and treat the resulting variable as __unsafe_unretained for the purposes of init/destroy in the two places it can come up. llvm-svn: 133243
* arc: diagnose dereferencing a __weak pointer which may beFariborz Jahanian2011-06-161-0/+15
| | | | | | null at any time. // rdar://9612030 llvm-svn: 133168
* Automatic Reference Counting.John McCall2011-06-151-0/+550
Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
OpenPOWER on IntegriCloud