| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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
|
|
|
|
|
|
| |
SourceManager and FullSourceLoc.
llvm-svn: 135969
|
|
|
|
|
|
| |
SourceManager and FullSourceLoc.
llvm-svn: 135965
|
|
|
|
| |
llvm-svn: 135915
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
Mulder!
llvm-svn: 135855
|
|
|
|
|
|
|
|
| |
LLVM.h imports
them into the clang namespace.
llvm-svn: 135852
|
|
|
|
|
|
|
| |
some common llvm types: stringref and smallvector. This cleans up the codebase
quite a bit.
llvm-svn: 135576
|
|
|
|
| |
llvm-svn: 135492
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
with __unsafe_unretained parameters. Emit error for strong/weak ones. rdar://9206226
llvm-svn: 135381
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 135309
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
ARCMigrate.
llvm-svn: 135223
|
|
|
|
|
|
| |
errors. rdar://9402555.
llvm-svn: 135213
|
|
|
|
|
|
|
|
| |
used.
Keep the error if the result is unused. rdar://9552694.
llvm-svn: 135209
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
'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
|
|
|
|
|
|
| |
command-line flags. rdar://9567824
llvm-svn: 135115
|
|
|
|
|
|
| |
@synthesizing it.
llvm-svn: 135067
|
|
|
|
|
|
|
|
| |
'retain' -> 'strong', and add
'weak or unsafe_unretained' when 'assign' is missing. rdar://9496219&9602589.
llvm-svn: 135065
|
|
|
|
| |
llvm-svn: 135003
|
|
|
|
|
|
|
|
|
|
| |
with objc_arc_weak_reference_unavailable
or is in a list of classes not supporting 'weak'.
rdar://9489367.
llvm-svn: 135002
|
|
|
|
| |
llvm-svn: 134876
|
|
|
|
| |
llvm-svn: 134875
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
Lexer, since they depend on it now.
llvm-svn: 134644
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
'ownership', not 'lifetime'.
rdar://9477613.
llvm-svn: 133779
|
|
|
|
| |
llvm-svn: 133769
|
|
|
|
| |
llvm-svn: 133763
|
|
|
|
| |
llvm-svn: 133762
|
|
|
|
|
|
| |
rdar://8939557
llvm-svn: 133627
|
|
|
|
| |
llvm-svn: 133557
|
|
|
|
|
|
|
|
| |
cut down on one compilation
pass and increase migration speed.
llvm-svn: 133540
|
|
|
|
| |
llvm-svn: 133539
|
|
|
|
|
|
| |
rdar://9644061
llvm-svn: 133480
|
|
|
|
|
|
| |
avoid hacky delegation to the driver for that.
llvm-svn: 133464
|
|
|
|
|
|
|
|
| |
initialization of SourceManager
because it is going to modify the input file.
llvm-svn: 133323
|
|
|
|
| |
llvm-svn: 133322
|
|
|
|
|
|
| |
hoped it would be.
llvm-svn: 133315
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 133140
|
|
for this.
llvm-svn: 133104
|