summaryrefslogtreecommitdiffstats
path: root/lib/ARCMigrate/TransProperties.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [arcmt] Fix a bug where a property in a class extension, that did not existArgyrios Kyrtzidis2012-03-291-3/+8
| | | | | | | | | in the interface, got its attribute rewritten twice, resulting in 'weakweak' or 'strongstrong'. rdar://11047179 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153621 91177308-0d34-0410-b5e6-96231b3b80d8
* arg migrator: change all "assign" of object propertiesFariborz Jahanian2012-01-211-9/+11
| | | | | | | to "strong" when migrating from GC. // rdar://10532449 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148607 91177308-0d34-0410-b5e6-96231b3b80d8
* arc migrator: replace "retain" attribute with "strong"Fariborz Jahanian2012-01-201-4/+6
| | | | | | | | which have same semantics in mrr as well as arr. // rdar://10688312 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148559 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Integrate GC __weak into property attributes even when we don't haveArgyrios Kyrtzidis2011-11-281-46/+2
| | | | | | the implementation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145224 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Don't add __weak if there is already a GC __weak and make sure to clearArgyrios Kyrtzidis2011-11-281-6/+12
| | | | | | __weak from a readonly property. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145210 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Take into account that all properties are strong-by-default now and ↵Argyrios Kyrtzidis2011-11-081-42/+7
| | | | | | fix the test. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144146 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Now that readonly properties are strong-by-default, do not add ↵Argyrios Kyrtzidis2011-11-081-1/+1
| | | | | | redundant 'strong'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144136 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Now that properties are strong by default, avoid adding redundant ↵Argyrios Kyrtzidis2011-11-081-2/+4
| | | | | | | | '(strong)' property attribute. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144078 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] In GC, handle (assign) @properties.Argyrios Kyrtzidis2011-11-071-103/+41
| | | | | | | | | -Move __strong/__weak added to a property type to the property attribute, e.g. "@property (assign) __weak Foo *prop;" --> "@property (weak) Foo *prop;" -Remove (assign) in a property so that it becomes strong-by-default in ARC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143979 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Map property decls to their GC attributes.Argyrios Kyrtzidis2011-11-071-2/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143978 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Make PropertiesRewriter::getPropertyType return the unqualified type.Argyrios Kyrtzidis2011-11-061-4/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143884 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Collect all the places where GC attributes __strong/__weak occur.Argyrios Kyrtzidis2011-11-061-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143883 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Refactor PropertiesRewriter to use MigrationContext.Argyrios Kyrtzidis2011-11-061-2/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143882 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Rewrite attributes in extensions as well. rdar://9992142Argyrios Kyrtzidis2011-10-181-17/+83
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142407 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] In ARC default for properties is 'strong' so just remove a 'retain' ↵Argyrios Kyrtzidis2011-10-171-3/+37
| | | | | | | | if possible, instead of changing it to 'strong'. rdar://9984862. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142304 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename the ARC cast kinds to start with "ARC".John McCall2011-09-101-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139466 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] When checking whether properties needs to be strong or not, take ↵Argyrios Kyrtzidis2011-08-101-0/+5
| | | | | | | | into account that assigning result of -retain means it should be strong. rdar://9931757. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137252 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] More automatic transformations and safety improvements; rdar://9615812 :Argyrios Kyrtzidis2011-07-271-10/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Replace calling -zone with 'nil'. -zone is obsolete in ARC. - Allow removing retain/release on a static global var. - Fix assertion hit when scanning for name references outside a NSAutoreleasePool scope. - Automatically add bridged casts for results of objc method calls and when calling CFRetain, for example: NSString *s; CFStringRef ref = [s string]; -> CFStringRef ref = (__bridge CFStringRef)([s string]); ref = s.string; -> ref = (__bridge CFStringRef)(s.string); ref = [NSString new]; -> ref = (__bridge_retained CFStringRef)([NSString new]); ref = [s newString]; -> ref = (__bridge_retained CFStringRef)([s newString]); ref = [[NSString alloc] init]; -> ref = (__bridge_retained CFStringRef)([[NSString alloc] init]); ref = [[s string] retain]; -> ref = (__bridge_retained CFStringRef)([s string]); ref = CFRetain(s); -> ref = (__bridge_retained CFTypeRef)(s); ref = [s retain]; -> ref = (__bridge_retained CFStringRef)(s); - Emit migrator error when trying to cast to CF type the result of autorelease/release: for CFStringRef f3() { return (CFStringRef)[[[NSString alloc] init] autorelease]; } emits: t.m:12:10: error: [rewriter] it is not safe to cast to 'CFStringRef' the result of 'autorelease' message; a __bridge cast may result in a pointer to a destroyed object and a __bridge_retained may leak the object return (CFStringRef)[[[NSString alloc] init] autorelease]; ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.m:12:3: note: [rewriter] remove the cast and change return type of function to 'NSString *' to have the object automatically autoreleased return (CFStringRef)[[[NSString alloc] init] autorelease]; ^ - Before changing attributes to weak/unsafe_unretained, check if the backing ivar is set to a +1 object, in which case use 'strong' instead. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136208 91177308-0d34-0410-b5e6-96231b3b80d8
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-9/+8
| | | | | | | | | LLVM.h imports them into the clang namespace. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135852 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Add weak/unsafe_unretained for "@property (readonly)" when we are ↵Argyrios Kyrtzidis2011-07-131-1/+1
| | | | | | @synthesizing it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135067 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] For properties rewrite 'assign' -> 'weak or unsafe_unretained', ↵Argyrios Kyrtzidis2011-07-131-133/+237
| | | | | | | | 'retain' -> 'strong', and add 'weak or unsafe_unretained' when 'assign' is missing. rdar://9496219&9602589. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135065 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Before applying '__weak' check whether the objc class is annotated ↵Argyrios Kyrtzidis2011-07-121-2/+2
| | | | | | | | | | with objc_arc_weak_reference_unavailable or is in a list of classes not supporting 'weak'. rdar://9489367. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135002 91177308-0d34-0410-b5e6-96231b3b80d8
* Change the driver's logic about Objective-C runtimes: abstract out aJohn McCall2011-07-061-2/+2
| | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134453 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename objc_lifetime -> objc_ownership, and modify diagnostics to talk about ↵Argyrios Kyrtzidis2011-06-241-4/+4
| | | | | | | | 'ownership', not 'lifetime'. rdar://9477613. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133779 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Break apart Transforms.cpp.Argyrios Kyrtzidis2011-06-211-0/+260
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133539 91177308-0d34-0410-b5e6-96231b3b80d8