summaryrefslogtreecommitdiffstats
path: root/clang/lib/ARCMigrate
Commit message (Collapse)AuthorAgeFilesLines
* 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
* [arcmt] Make -Warc-unsafe-retained-assign an error when migrating. ↵Argyrios Kyrtzidis2011-06-221-0/+2
| | | | | | rdar://8939557 llvm-svn: 133627
* Unbreak the CMake buildAlexis Hunt2011-06-211-1/+1
| | | | llvm-svn: 133557
* [arcmt] Merge 'removeEmptyStatements' and 'removeDeallocMethod' passes to ↵Argyrios Kyrtzidis2011-06-216-216/+215
| | | | | | | | cut down on one compilation pass and increase migration speed. llvm-svn: 133540
* [arcmt] Break apart Transforms.cpp.Argyrios Kyrtzidis2011-06-2114-1941/+2180
| | | | llvm-svn: 133539
* [arcmt] Always add '__bridge' cast when 'self' is cast to a C pointer. ↵Argyrios Kyrtzidis2011-06-201-33/+29
| | | | | | rdar://9644061 llvm-svn: 133480
* [arcmt] Find out whether there is an ARC runtime directly from the triple, ↵Argyrios Kyrtzidis2011-06-201-50/+66
| | | | | | avoid hacky delegation to the driver for that. llvm-svn: 133464
* [arcmt] Fix the ARC migrator. -arcmt-modify requires running before the ↵Argyrios Kyrtzidis2011-06-183-12/+17
| | | | | | | | initialization of SourceManager because it is going to modify the input file. llvm-svn: 133323
* [arcmt] Const'ify.Argyrios Kyrtzidis2011-06-182-6/+6
| | | | llvm-svn: 133322
* [arcmt] Remove '-arcmt-modify-in-memory', it turned out less useful than we ↵Argyrios Kyrtzidis2011-06-172-50/+0
| | | | | | hoped it would be. llvm-svn: 133315
* Objective-C fast enumeration loop variables are not retained in ARC, butJohn McCall2011-06-171-4/+1
| | | | | | | | | | | | they should still be officially __strong for the purposes of errors, block capture, etc. Make a new bit on variables, isARCPseudoStrong(), and set this for 'self' and these enumeration-loop variables. Change the code that was looking for the old patterns to look for this bit, and change IR generation to find this bit and treat the resulting variable as __unsafe_unretained for the purposes of init/destroy in the two places it can come up. llvm-svn: 133243
* Raise the ARCMT functionality in Clang into proper FrontendActions.Chandler Carruth2011-06-162-0/+59
| | | | | | | | | | | | | | | | | | | | | These are somewhat special in that they wrap any other FrontendAction, running various ARC transformations or checks prior to the standard action's run. To implement them easily, this extends FrontendAction to have a WrapperFrontendAction utility class which forwards all calls by default to an inner action setup at construction time. This is then subclassed to override the specific behavior needed by the different ARCMT tools. Finally, FrontendTool is taught how to create these wrapper actions from the existing flags and options structures. The result is that clangFrontend no longer depends on clangARCMigrate. This is very important, as clangARCMigrate *heavily* depends on clangFrontend. Fundamentally ARCMigrate is at the same layer as a library like Rewrite, sitting firmly on top of the Frontend, but tied together with the FrontendTool when building the clang binary itself. llvm-svn: 133161
* [arcmt] Fix tests in non-darwin.Argyrios Kyrtzidis2011-06-161-0/+5
| | | | llvm-svn: 133140
* The ARC Migration Tool. All the credit goes to Argyrios and FariborzJohn McCall2011-06-157-0/+3745
for this. llvm-svn: 133104
OpenPOWER on IntegriCloud