summaryrefslogtreecommitdiffstats
path: root/test/ARCMT/nonobjc-to-objc-cast.m
Commit message (Collapse)AuthorAgeFilesLines
* Allow (Object *)kMyGlobalCFObj casts without bridgingBen Langmuir2015-02-251-3/+8
| | | | | | | | | | | | | | | | Previously we allowed these casts only for constants declared in system headers, which we assume are retain/release-neutral. Now also allow them for constants in user headers, treating them as +0. Practically, this means that we will now allow: id x = (id)kMyGlobalConst; But unlike with system headers we cannot mix them with +1 values: id y = (id)(b ? kMyGlobalConst : [Obj newValAtPlusOne]); // error id z = (id)(b ? kSystemGlobalConst: [Obj newValAtPlusOne]); // OK Thanks to John for suggesting this improvement. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230534 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove all DISABLE lines from testsAlp Toker2013-12-081-1/+0
| | | | | | | | There's no evidence that a 'DISABLE' directive ever existed. Let's see if anything breaks.. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196733 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] At an unbridged cast error, if we're returning a load-of-ivar from a ↵Argyrios Kyrtzidis2012-06-071-5/+22
| | | | | | | | | | +0 method, automatically insert a __bridge cast. radar://11560638 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158127 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] The migrator tests for the buildbot in ↵Argyrios Kyrtzidis2012-01-121-1/+1
| | | | | | | | http://lab.llvm.org:8011/builders/clang-native-mingw32-win7/ are messed up, XFAIL does not help. Waiting until DISABLE is supported.. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148012 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] XFAIL on mingw.Argyrios Kyrtzidis2012-01-101-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147830 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Disable tests in mingw, no idea why they are failing there.Argyrios Kyrtzidis2012-01-071-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147713 91177308-0d34-0410-b5e6-96231b3b80d8
* Make -fobjc-nonfragile-abi the -cc1 default, since it's theJohn McCall2011-10-021-2/+2
| | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140957 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Use __bridge_retained when passing an objc object to a CF parameterArgyrios Kyrtzidis2011-09-141-0/+5
| | | | | | annotated with cf_consumed attribute. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139709 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] More automatic transformations and safety improvements; rdar://9615812 :Argyrios Kyrtzidis2011-07-271-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* [arcmt] Always add '__bridge' cast when 'self' is cast to a C pointer. ↵Argyrios Kyrtzidis2011-06-201-2/+8
| | | | | | rdar://9644061 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133480 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] Make arcmt-test accept cc1 options to make it more portable and ↵Argyrios Kyrtzidis2011-06-161-1/+1
| | | | | | hopefully fix MSVC failures. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133119 91177308-0d34-0410-b5e6-96231b3b80d8
* The ARC Migration Tool. All the credit goes to Argyrios and FariborzJohn McCall2011-06-151-0/+32
for this. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133104 91177308-0d34-0410-b5e6-96231b3b80d8