summaryrefslogtreecommitdiffstats
path: root/clang/test/ARCMT
Commit message (Collapse)AuthorAgeFilesLines
...
* [arcmt] Fix handling NSMakeCollectable inside an objc method.Argyrios Kyrtzidis2011-11-072-0/+8
| | | | llvm-svn: 143980
* [arcmt] In GC, handle (assign) @properties.Argyrios Kyrtzidis2011-11-072-0/+38
| | | | | | | | | -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. llvm-svn: 143979
* [arcmt] In GC, change '__weak' -> '__unsafe_unretained' when appliedArgyrios Kyrtzidis2011-11-072-6/+20
| | | | | | to objects of classes that don't support ARC weak llvm-svn: 143976
* [arcmt] In GC, error for __strong/__weak on non-objc pointers.Argyrios Kyrtzidis2011-11-062-0/+6
| | | | llvm-svn: 143887
* [arcmt] In GC, clear redundant __strong's.Argyrios Kyrtzidis2011-11-063-2/+13
| | | | llvm-svn: 143886
* [arcmt] In GC, error out when there is a call that returns a pointer toArgyrios Kyrtzidis2011-11-041-0/+3
| | | | | | GC managed non-objc object memory. llvm-svn: 143747
* [arcmt] For GC, cleanup and turn -finalize to -dealloc.Argyrios Kyrtzidis2011-11-042-0/+53
| | | | llvm-svn: 143701
* [arcmt] In GC, error for use of CFMakeCollectable because it will leak theArgyrios Kyrtzidis2011-11-041-0/+11
| | | | | | object that it receives in ARC. llvm-svn: 143700
* In C++ keep unavailable function calls in the AST, like in C/ObjC.Argyrios Kyrtzidis2011-11-042-0/+4
| | | | | | This allows the migrator to visit and fix them. llvm-svn: 143699
* [arcmt] In GC, transform NSMakeCollectable to CFBridgingRelease.Argyrios Kyrtzidis2011-11-043-0/+23
| | | | llvm-svn: 143698
* Further refine the diagnostic categories for ARC diagnostics. Addresses ↵Ted Kremenek2011-10-201-1/+1
| | | | | | <rdar://problem/10245086>. llvm-svn: 142571
* [arcmt] Rewrite attributes in extensions as well. rdar://9992142Argyrios Kyrtzidis2011-10-182-0/+28
| | | | llvm-svn: 142407
* [arcmt] In ARC default for properties is 'strong' so just remove a 'retain' ↵Argyrios Kyrtzidis2011-10-177-12/+24
| | | | | | | | if possible, instead of changing it to 'strong'. rdar://9984862. llvm-svn: 142304
* Teach the ARC compiler to not require __bridge casts whenJohn McCall2011-10-172-6/+6
| | | | | | | passing/receiving CF objects at +0 to/from Objective-C methods or audited C functions. llvm-svn: 142219
* Try fixing windows bots.Argyrios Kyrtzidis2011-10-081-2/+2
| | | | llvm-svn: 141462
* [arcmt] Ignore linking errors when doing ARC migration, rdar://10247606Argyrios Kyrtzidis2011-10-071-0/+9
| | | | llvm-svn: 141434
* Make -fobjc-nonfragile-abi the -cc1 default, since it's theJohn McCall2011-10-0252-96/+96
| | | | | | | | | | | | | | | | | | | increasingly prevailing case to the point that new features like ARC don't even support the fragile ABI anymore. This required a little bit of reshuffling with exceptions because a check was assuming that ObjCNonFragileABI was only being set in ObjC mode, and that's actually a bit obnoxious to do. Most, though, it involved a perl script to translate a ton of test cases. Mostly no functionality change for driver users, although there are corner cases with disabling language-specific exceptions that we should handle more correctly now. llvm-svn: 140957
* [arcmt] Use __bridge_retained when passing an objc object to a CF parameterArgyrios Kyrtzidis2011-09-143-0/+12
| | | | | | annotated with cf_consumed attribute. llvm-svn: 139709
* [arcmt] Try fixing the windows buildbot.Argyrios Kyrtzidis2011-09-077-6/+54
| | | | llvm-svn: 139262
* [arcmt] Remove xfail on test for windows, Takumi reported that it passes ↵Argyrios Kyrtzidis2011-09-071-2/+0
| | | | | | mingw and msvc. llvm-svn: 139223
* [arcmt] Clear out temporary dirs in the tests or we may get failures because ↵Argyrios Kyrtzidis2011-09-013-0/+3
| | | | | | of leftovers. llvm-svn: 138971
* [arcmt] Fix test/ARCMT/remove-statements.m regression due toArgyrios Kyrtzidis2011-09-012-1/+2
| | | | | | | | Objective-C method buffering(rdar://10056942) Turned out the same issue existed for C++ inline methods. llvm-svn: 138960
* objective-c - This patch buffers method implementations Fariborz Jahanian2011-08-311-0/+1
| | | | | | | | | | | | | and does the Sema on their body after the entire class/category @implementation is seen. This change allows messaging of forward private methods, as well as, access to synthesized ivars of properties with foward synthesize declarations; among others. In effect, this patch removes several restrictions placed on objective-c due to in-place semantics processing of methods. This is part of // rdar://8843851. llvm-svn: 138865
* [arcmt] Xfail the test for windows.Argyrios Kyrtzidis2011-08-271-0/+2
| | | | llvm-svn: 138696
* [arcmt] Add a test case for r138671 and improve the loop.Argyrios Kyrtzidis2011-08-261-0/+7
| | | | llvm-svn: 138674
* [arcmt] When checking whether properties needs to be strong or not, take ↵Argyrios Kyrtzidis2011-08-102-8/+8
| | | | | | | | into account that assigning result of -retain means it should be strong. rdar://9931757. llvm-svn: 137252
* objective-c: reverse patch for // rdar://9818354Fariborz Jahanian2011-08-012-2/+2
| | | | llvm-svn: 136658
* [arcmt] Revert r135382, there's a different approach in r135764. rdar://9821111.Argyrios Kyrtzidis2011-07-272-64/+0
| | | | llvm-svn: 136209
* [arcmt] More automatic transformations and safety improvements; rdar://9615812 :Argyrios Kyrtzidis2011-07-2712-5/+157
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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. llvm-svn: 136208
* objective-c: Any use of @synthesize or @dynamic lexically after a method (or ↵Fariborz Jahanian2011-07-222-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
* [arcmt] Add some additional driver flags to optionally emit or save the ↵Argyrios Kyrtzidis2011-07-192-0/+62
| | | | | | | | | | | pre-migration ARC errors. -arcmt-migrate-emit-errors : Emits the pre-migration ARC errors but it doesn't affect anything else -arcmt-migrate-report-output : Writes out the pre-migration ARC errors to the provided plist file rdar://9791454 llvm-svn: 135491
* [arcmt] When a NSData's 'bytes' family of methods are used on a local var,Argyrios Kyrtzidis2011-07-182-0/+64
| | | | | | | | | add __attribute__((objc_precise_lifetime)) to make sure that the object (and its data) will not get released before the var goes out-of-scope. rdar://9206226 llvm-svn: 135382
* [arcmt] NSInvocation's [get/set]ReturnValue and [get/set]Argument are only safeArgyrios Kyrtzidis2011-07-181-0/+43
| | | | | | with __unsafe_unretained parameters. Emit error for strong/weak ones. rdar://9206226 llvm-svn: 135381
* [arcmt] It's not safe to remove the -release on "[[someivar delegate] ↵Argyrios Kyrtzidis2011-07-151-1/+8
| | | | | | | | | | | | | | | | | | release];" since it's very likely that, after migration, the object that was passed to 'setDelegate:' will not be properly retained, e.g: -whatever { id x = [[MyDoHicky alloc] init]; [someivar setDelegate: x]; // x won't get retained in ARC. } -dealloc { [[someivar delegate] release]; // give migration error here. } rdar://8858009 llvm-svn: 135327
* [arcmt] Rewrite to "foo = nil;" not "foo = 0;", as suggested by Jordy.Argyrios Kyrtzidis2011-07-152-1/+5
| | | | llvm-svn: 135309
* [arcmt] For:Argyrios Kyrtzidis2011-07-152-4/+14
| | | | | | | | | | | | | | | id x = ... @try { ... } @finally { [x release]; } Migrator will drop the release. It's better to change it to "x = 0" in a @finally to avoid leak when exception is thrown. rdar://9398256 llvm-svn: 135301
* [arcmt] Don't remove retains/releases on a global variable, flag them with ↵Argyrios Kyrtzidis2011-07-141-0/+6
| | | | | | errors. rdar://9402555. llvm-svn: 135213
* [arcmt] Allow -retain of an __unsafe_unretained receiver if the result gets ↵Argyrios Kyrtzidis2011-07-141-0/+1
| | | | | | | | used. Keep the error if the result is unused. rdar://9552694. llvm-svn: 135209
* [arcmt] Emit an error for unused -autorelease messages.Argyrios Kyrtzidis2011-07-144-6/+7
| | | | | | | | | | | An unused autorelease is badness. If we remove it the receiver will likely die immediately while previously it was kept alive by the autorelease pool. This is bad practice in general, so leave it and emit an error to force the user to restructure his code. rdar://9599884 llvm-svn: 135193
* [arcmt] Make sure migrating to ARC works even if '-fobjc-arc' is included in ↵Argyrios Kyrtzidis2011-07-145-0/+57
| | | | | | command-line flags. rdar://9567824 llvm-svn: 135115
* [arcmt] Add weak/unsafe_unretained for "@property (readonly)" when we are ↵Argyrios Kyrtzidis2011-07-132-4/+6
| | | | | | @synthesizing it. llvm-svn: 135067
* [arcmt] For properties rewrite 'assign' -> 'weak or unsafe_unretained', ↵Argyrios Kyrtzidis2011-07-138-27/+29
| | | | | | | | 'retain' -> 'strong', and add 'weak or unsafe_unretained' when 'assign' is missing. rdar://9496219&9602589. llvm-svn: 135065
* [arcmt] Also avoid 'weak' for forward references to objc classes.Argyrios Kyrtzidis2011-07-122-4/+10
| | | | llvm-svn: 135003
* [arcmt] Before applying '__weak' check whether the objc class is annotated ↵Argyrios Kyrtzidis2011-07-122-14/+46
| | | | | | | | | | with objc_arc_weak_reference_unavailable or is in a list of classes not supporting 'weak'. rdar://9489367. llvm-svn: 135002
* In ARC mode, consider Objective-C lifetime types (object pointers andDouglas Gregor2011-07-121-3/+3
| | | | | | | | | | | | | | 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
* Tweak two tests with MSYS-bash tolerant.NAKAMURA Takumi2011-07-111-1/+1
| | | | llvm-svn: 134899
* [arcmt] Remove test/ARCMT/with-working-dir.m which fails at windows hosts ↵Argyrios Kyrtzidis2011-07-092-90/+0
| | | | | | | | and is not that useful in the first place. http://llvm.org/PR10312. llvm-svn: 134845
* [arcmt] Introduce new '-ccc-arcmt-migrate <path>' ARC migration driver option.Argyrios Kyrtzidis2011-07-098-0/+57
| | | | | | | | | | | | | | | | | | | | This is a new mode of migration, where we avoid modifying the original files but we emit temporary files instead. <path> will be used to keep migration process metadata. Currently the temporary files that are produced are put in the system's temp directory but we can put them in the <path> if is necessary. Also introduce new ARC migration functions in libclang whose only purpose, currently, is to accept <path> and provide pairs of original file/transformed file to map from the originals to the files after transformations are applied. Finally introduce the c-arcmt-test utility that exercises the new libclang functions, update arcmt-test, and add tests for the whole process. rdar://9735086. llvm-svn: 134844
* Change the driver's logic about Objective-C runtimes: abstract out aJohn McCall2011-07-066-6/+6
| | | | | | | | | | | | 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
* [ARC] When casting from a pointer to an objective-c object with known ↵Argyrios Kyrtzidis2011-07-011-1/+1
| | | | | | | | | | | | ownership, if the cast type has no ownership specified, implicitly "transfer" the ownership of the cast'ed type to the cast type: id x; (NSString**)&x; // Casting as (__strong NSString**). llvm-svn: 134275
OpenPOWER on IntegriCloud