summaryrefslogtreecommitdiffstats
path: root/clang/test/ARCMT
Commit message (Collapse)AuthorAgeFilesLines
* Modify how the -verify flag works. Currently, the verification string andRichard Trieu2011-12-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostic message are compared. If either is a substring of the other, then no error is given. This gives rise to an unexpected case: // expect-error{{candidate function has different number of parameters}} will match the following error messages from Clang: candidate function has different number of parameters (expected 1 but has 2) candidate function has different number of parameters It will also match these other error messages: candidate function function has different number of parameters number of parameters This patch will change so that the verification string must be a substring of the diagnostic message before accepting. Also, all the failing tests from this change have been corrected. Some stats from this cleanup: 87 - removed extra spaces around verification strings 70 - wording updates to diagnostics 40 - extra leading or trailing characters (typos, unmatched parens or quotes) 35 - diagnostic level was included (error:, warning:, or note:) 18 - flag name put in the warning (-Wprotocol) llvm-svn: 146619
* [arcmt] Un-XFAIL a test.Argyrios Kyrtzidis2011-12-091-7/+38
| | | | llvm-svn: 146210
* Make changes to SDiagsWriter to make it work in combination with the ARC ↵Argyrios Kyrtzidis2011-12-071-0/+48
| | | | | | | | | | | | | migrator: -Allow it to be used with multiple BeginSourceFile/EndSourceFile calls; for this introduce a "finish" callback method in the DiagnosticConsumer. SDiagsWriter finishes up the serialization file inside this method. -Make it independent of any particular DiagnosticsEngine; make it use the SourceManager of the Diagnostic object. -Ignore null source ranges. llvm-svn: 146020
* objc: issue deprecated/unavailable diagnostic whenFariborz Jahanian2011-12-071-0/+1
| | | | | | | methods with these attributes are sent to receivers of 'id' type too. // rdar://10459930 llvm-svn: 145999
* [arcmt] Integrate GC __weak into property attributes even when we don't haveArgyrios Kyrtzidis2011-11-282-0/+12
| | | | | | the implementation. llvm-svn: 145224
* [arcmt] Don't add __weak if there is already a GC __weak and make sure to clearArgyrios Kyrtzidis2011-11-282-2/+10
| | | | | | __weak from a readonly property. llvm-svn: 145210
* [arcmt] Take into account that all properties are strong-by-default now and ↵Argyrios Kyrtzidis2011-11-082-8/+6
| | | | | | fix the test. llvm-svn: 144146
* [arcmt] Now that readonly properties are strong-by-default, do not add ↵Argyrios Kyrtzidis2011-11-083-4/+6
| | | | | | redundant 'strong'. llvm-svn: 144136
* objc-arc: 'readonly' property of retainable objectFariborz Jahanian2011-11-082-4/+6
| | | | | | type is strong by default too. // rdar://10410903 llvm-svn: 144118
* [arcmt] Now that properties are strong by default, avoid adding redundant ↵Argyrios Kyrtzidis2011-11-082-2/+6
| | | | | | | | '(strong)' property attribute. llvm-svn: 144078
* [arcmt] When we already removed a __weak, don't try to change it to ↵Argyrios Kyrtzidis2011-11-082-0/+141
| | | | | | | | __unsafe_unretained later on, or we will end up with a redundant '__unsafe_unretained'. llvm-svn: 144059
* [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
OpenPOWER on IntegriCloud