summaryrefslogtreecommitdiffstats
path: root/clang/lib/ARCMigrate
Commit message (Collapse)AuthorAgeFilesLines
...
* Rename SourceLocation::getFileLocWithOffset -> getLocWithOffset.Argyrios Kyrtzidis2011-09-193-3/+3
| | | | | | It already works (and is useful with) macro locs as well. llvm-svn: 140057
* [arcmt] Use __bridge_retained when passing an objc object to a CF parameterArgyrios Kyrtzidis2011-09-141-0/+28
| | | | | | annotated with cf_consumed attribute. llvm-svn: 139709
* Rename the ARC cast kinds to start with "ARC".John McCall2011-09-102-3/+3
| | | | llvm-svn: 139466
* Give conversions of block pointers to ObjC pointers a different cast kindJohn McCall2011-09-091-1/+1
| | | | | | | | than conversions of C pointers to ObjC pointers. In order to ensure that we've caught every case, add asserts to CastExpr that strictly determine which cast kind is used for which kind of bit cast. llvm-svn: 139352
* [arcmt] Fix test/ARCMT/remove-statements.m regression due toArgyrios Kyrtzidis2011-09-013-32/+73
| | | | | | | | Objective-C method buffering(rdar://10056942) Turned out the same issue existed for C++ inline methods. llvm-svn: 138960
* Twinify.Benjamin Kramer2011-08-271-21/+15
| | | | llvm-svn: 138689
* Try to unbreak the build on systems where uint64_t isn't something that ↵Douglas Gregor2011-08-261-1/+1
| | | | | | StringRef::getAsInteger can handle as its second argument llvm-svn: 138680
* [arcmt] Add a test case for r138671 and improve the loop.Argyrios Kyrtzidis2011-08-261-4/+1
| | | | llvm-svn: 138674
* [arcmt] Fix horrible bug where migrating files if there is a space in the pathsArgyrios Kyrtzidis2011-08-261-12/+15
| | | | | | of the migrated files. rdar://10022801 llvm-svn: 138671
* For the MacroExpands preprocessor callback, also pass the SourceRangeArgyrios Kyrtzidis2011-08-181-1/+2
| | | | | | of expansion (for function macros it includes the right paren). llvm-svn: 137909
* Fix "Uninitialized" warnings on g++-4.4.NAKAMURA Takumi2011-08-141-1/+1
| | | | | | In fact, they are false warnings but it seems g++-4.4 might be unable to know they must be false. llvm-svn: 137568
* [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. llvm-svn: 137252
* Make helper functions static.Benjamin Kramer2011-08-021-4/+5
| | | | llvm-svn: 136679
* [arcmt] Revert r135382, there's a different approach in r135764. rdar://9821111.Argyrios Kyrtzidis2011-07-271-35/+0
| | | | llvm-svn: 136209
* [arcmt] More automatic transformations and safety improvements; rdar://9615812 :Argyrios Kyrtzidis2011-07-277-23/+201
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* Rename getInstantiationLineNumber to getExpansionLineNumber in bothChandler Carruth2011-07-251-1/+1
| | | | | | SourceManager and FullSourceLoc. llvm-svn: 135969
* Rename getInstantiationColumnNumber to getExpansionColumnNumber in bothChandler Carruth2011-07-251-1/+1
| | | | | | SourceManager and FullSourceLoc. llvm-svn: 135965
* Rename SourceManager::getInstantiationRange to getExpansionRange.Chandler Carruth2011-07-252-2/+2
| | | | llvm-svn: 135915
* Mechanically rename SourceManager::getInstantiationLoc andChandler Carruth2011-07-253-13/+13
| | | | | | | | FullSourceLoc::getInstantiationLoc to ...::getExpansionLoc. This is part of the API and documentation update from 'instantiation' as the term for macros to 'expansion'. llvm-svn: 135914
* Move ArrayRef to LLVM.h and eliminate now-redundant qualifiers, patch by Jon ↵Chris Lattner2011-07-234-15/+15
| | | | | | Mulder! llvm-svn: 135855
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-2316-96/+79
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* now that we have a centralized place to do so, add some using declarations forChris Lattner2011-07-201-10/+10
| | | | | | | some common llvm types: stringref and smallvector. This cleans up the codebase quite a bit. llvm-svn: 135576
* Update CMake build.Benjamin Kramer2011-07-191-0/+1
| | | | llvm-svn: 135492
* [arcmt] Add some additional driver flags to optionally emit or save the ↵Argyrios Kyrtzidis2011-07-194-10/+261
| | | | | | | | | | | 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-181-0/+34
| | | | | | | | | 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-187-3/+100
| | | | | | 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-9/+31
| | | | | | | | | | | | | | | | | | 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-151-2/+8
| | | | llvm-svn: 135309
* [arcmt] For:Argyrios Kyrtzidis2011-07-151-8/+31
| | | | | | | | | | | | | | | 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
* Switch comments about 'macro instantiation' to 'macro expansion' inChandler Carruth2011-07-151-2/+2
| | | | | | ARCMigrate. llvm-svn: 135223
* [arcmt] Don't remove retains/releases on a global variable, flag them with ↵Argyrios Kyrtzidis2011-07-144-11/+22
| | | | | | errors. rdar://9402555. llvm-svn: 135213
* [arcmt] Allow -retain of an __unsafe_unretained receiver if the result gets ↵Argyrios Kyrtzidis2011-07-141-1/+2
| | | | | | | | 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-141-2/+14
| | | | | | | | | | | 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
* Convert terminology in the Lexer from 'instantiate' and variants toChandler Carruth2011-07-142-3/+3
| | | | | | | | | 'expand'. Also update the public API it provides to the new term, and propagate that update to the various clients. No functionality changed. llvm-svn: 135138
* [arcmt] Make sure migrating to ARC works even if '-fobjc-arc' is included in ↵Argyrios Kyrtzidis2011-07-141-1/+9
| | | | | | command-line flags. rdar://9567824 llvm-svn: 135115
* [arcmt] Add weak/unsafe_unretained for "@property (readonly)" when we are ↵Argyrios Kyrtzidis2011-07-131-1/+1
| | | | | | @synthesizing it. llvm-svn: 135067
* [arcmt] For properties rewrite 'assign' -> 'weak or unsafe_unretained', ↵Argyrios Kyrtzidis2011-07-133-135/+239
| | | | | | | | '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-121-0/+2
| | | | llvm-svn: 135003
* [arcmt] Before applying '__weak' check whether the objc class is annotated ↵Argyrios Kyrtzidis2011-07-124-4/+62
| | | | | | | | | | with objc_arc_weak_reference_unavailable or is in a list of classes not supporting 'weak'. rdar://9489367. llvm-svn: 135002
* [arcmt] Remove redundant has_error() check.Argyrios Kyrtzidis2011-07-101-2/+2
| | | | llvm-svn: 134876
* [arcmt] Try fixing test/ARCMT/migrate.m for windows hosts.Argyrios Kyrtzidis2011-07-101-1/+2
| | | | llvm-svn: 134875
* [arcmt] Introduce new '-ccc-arcmt-migrate <path>' ARC migration driver option.Argyrios Kyrtzidis2011-07-093-19/+87
| | | | | | | | | | | | | | | | | | | | 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
* Move SourceManager::isAt[Start/End]OfMacroInstantiation functions to the ↵Argyrios Kyrtzidis2011-07-072-3/+3
| | | | | | Lexer, since they depend on it now. llvm-svn: 134644
* In ARC, reclaim all return values of retainable type, not just thoseJohn McCall2011-07-073-9/+11
| | | | | | | | | | | | where we have an immediate need of a retained value. As an exception, don't do this when the call is made as the immediate operand of a __bridge retain. This is more in the way of a workaround than an actual guarantee, so it's acceptable to be brittle here. rdar://problem/9504800 llvm-svn: 134605
* Make the Preprocessor more memory efficient and improve macro instantiation ↵Argyrios Kyrtzidis2011-07-072-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostics. When a macro instantiation occurs, reserve a SLocEntry chunk with length the full length of the macro definition source. Set the spelling location of this chunk to point to the start of the macro definition and any tokens that are lexed directly from the macro definition will get a location from this chunk with the appropriate offset. For any tokens that come from argument expansion, '##' paste operator, etc. have their instantiation location point at the appropriate place in the instantiated macro definition (the argument identifier and the '##' token respectively). This improves macro instantiation diagnostics: Before: t.c:5:9: error: invalid operands to binary expression ('struct S' and 'int') int y = M(/); ^~~~ t.c:5:11: note: instantiated from: int y = M(/); ^ After: t.c:5:9: error: invalid operands to binary expression ('struct S' and 'int') int y = M(/); ^~~~ t.c:3:20: note: instantiated from: \#define M(op) (foo op 3); ~~~ ^ ~ t.c:5:11: note: instantiated from: int y = M(/); ^ The memory savings for a candidate boost library that abuses the preprocessor are: - 32% less SLocEntries (37M -> 25M) - 30% reduction in PCH file size (900M -> 635M) - 50% reduction in memory usage for the SLocEntry table (1.6G -> 800M) llvm-svn: 134587
* Change the driver's logic about Objective-C runtimes: abstract out aJohn McCall2011-07-063-5/+5
| | | | | | | | | | | | 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
* Rename objc_lifetime -> objc_ownership, and modify diagnostics to talk about ↵Argyrios Kyrtzidis2011-06-241-4/+4
| | | | | | | | 'ownership', not 'lifetime'. rdar://9477613. llvm-svn: 133779
* Unbreak the CMake build.Alexis Hunt2011-06-231-1/+0
| | | | llvm-svn: 133769
* [arcmt] Fully migrate ObjC++ classes, rdar://9660007.Argyrios Kyrtzidis2011-06-234-28/+8
| | | | llvm-svn: 133763
* [arcmt] Remove rewriteAllocCopyWithZone transformation; not needed anymore.Argyrios Kyrtzidis2011-06-233-225/+0
| | | | llvm-svn: 133762
OpenPOWER on IntegriCloud