Fariborz Jahanian
1a26927e3f
ObjectiveC migrator: start introducing NS_XXX annotations
...
to Method/functions returning ObjC objects. wip.
llvm-svn: 190005
2013-09-04 22:49:19 +00:00
Fariborz Jahanian
89f6d100a4
ObjectiveC migrator: Cannot use bridging annotations for
...
ObjectiveC methods. Apply specific annotations for them
instead as determined by the static analyzer.
llvm-svn: 189892
2013-09-04 00:10:06 +00:00
Fariborz Jahanian
d0fbf6cebd
ObjectiveC migrator: If we find a method that returns a C pointer
...
of some sort (but not an object, block pointer or CF pointers),
and is not annotated with the objc_returns_inner_pointer attribute,
we should suggest NS_RETURNS_INNER_POINTER annotation for these methods.
llvm-svn: 189707
2013-08-30 23:52:08 +00:00
Fariborz Jahanian
ff3476e499
ObjectiveC migrator: infer NS_ENUM even when user
...
specified NSUInteger as the followup typedef.
With this change, NS_OPTIONS is only inferred
based on looking up how enumerators are speficied
(if they her hexadecimal, power of 2, or have
bitwise constant expressions).
llvm-svn: 189682
2013-08-30 17:46:01 +00:00
Fariborz Jahanian
a23f4fb5c9
ObjectiveC migrator: User of hexadecimal enumerator
...
should infer migration to NS_OPTIONS.
llvm-svn: 189628
2013-08-30 00:10:37 +00:00
Fariborz Jahanian
55d6e6c930
ObjectiveC migrator. This patch infers readonly properties for no-parameter
...
instance methods returning non-void. This will be quite noisy. So, it is
placed under a new migrator flag -objcmt-migrate-readonly-property.
llvm-svn: 189537
2013-08-28 23:22:46 +00:00
Fariborz Jahanian
7dd7143a2b
ObjectiveC migrator: In suggesting 'instancetype' use clang's
...
hasRelatedResultType() as it knows of methods which have
related result type by default. Such methods do not need
a redundant 'instancetype'.
llvm-svn: 189520
2013-08-28 21:23:00 +00:00
Fariborz Jahanian
1a26c209f6
For methods where clang automatically infers instancetype from the selector
...
(e.g., all -init* methods), no need to suggest "instancetype" because it
is redundant.
llvm-svn: 189514
2013-08-28 20:49:58 +00:00
Fariborz Jahanian
63ffce2001
ObjectiveC migrator: Do not add explicit cf annotation for
...
cf functions which are CF_IMPLICIT_BRIDGING_ENABLED.
Add cf annotation to those not CF_IMPLICIT_BRIDGING_ENABLED
to reduce bridge casts.
llvm-svn: 189409
2013-08-27 22:42:30 +00:00
Roman Divacky
718fb1cdf9
Make the information about disabled ARCMT/Rewriter/StaticAnalyzer available
...
to lit and use this info to disable Analysis/FixIt/Rewriter/Analysis tests
when those are not compiled into clang.
llvm-svn: 189395
2013-08-27 19:27:35 +00:00
Fariborz Jahanian
2e9c19cc35
ObjectiveC migrator: builtin ObjectiveC types are not
...
audited types.
llvm-svn: 189072
2013-08-22 22:27:36 +00:00
Fariborz Jahanian
926fafb888
ObjectiveC migrator: Provide ARC annotations for
...
CF methods too.
llvm-svn: 189041
2013-08-22 18:35:27 +00:00
Fariborz Jahanian
b918d7a67b
ObjectibeC migrator. Annotate cf_consumed arguments,
...
as reported by static analyer API with CF_CONSUMED.
llvm-svn: 188922
2013-08-21 19:37:47 +00:00
Fariborz Jahanian
447b15ef22
ObjectiveC migrator: until we have beter understanding of
...
setter/getter implementations, migrate them to
nonatomic properties.
llvm-svn: 188914
2013-08-21 18:49:03 +00:00
Fariborz Jahanian
301b52145f
ObjectiveC migrator: make sure audited pragams are
...
dumped for last declarations in the current TU. wip.
llvm-svn: 188838
2013-08-20 22:42:13 +00:00
Fariborz Jahanian
5874e6d384
ObjectiveC migrator: More tweaking of heuristics
...
for an audited cf function to not include those
which are annotated by user.
llvm-svn: 188823
2013-08-20 20:45:28 +00:00
Fariborz Jahanian
9427939f65
ObjectiveC migrator: More tweaking of heuristics
...
for an audited cf function and addition of
a test case.
llvm-svn: 188816
2013-08-20 18:54:39 +00:00
Fariborz Jahanian
f63f0bf395
ObjetiveC migrator: fix the test in my last patch
...
to define real CF_RETURNS_RETAINED/CF_NO_RETURNS_RETAINED
pairs.
llvm-svn: 188497
2013-08-15 22:26:10 +00:00
Fariborz Jahanian
84ac1ded83
ObjectiveC migrator. Start annotating CF functions
...
with CF_RETURNS_RETAINED/CF_RETURNS_NOT_RETAINED as
appropriate.
llvm-svn: 188493
2013-08-15 21:44:38 +00:00
Fariborz Jahanian
313ae7009e
Add another test to my last patch (NS_OPTION vs. NS_ENUM)
...
ObjectiveC migration.
llvm-svn: 188480
2013-08-15 19:27:42 +00:00
Fariborz Jahanian
be7bc11f94
ObjectiveC migrator: In deciding NS_OPTION over
...
NS_ENUM, at least one power of 2 enumerator
must be greater than two.
llvm-svn: 188470
2013-08-15 18:46:37 +00:00
Fariborz Jahanian
c13c1b0f0d
ObjectiveC migrator: Fixes a crash and makes couple
...
of harmless changes.
llvm-svn: 188303
2013-08-13 18:01:42 +00:00
Argyrios Kyrtzidis
551c83d379
[arcmt] When handling unbridged casts, handle the body of BlockDecl separately because ParentMap does not record
...
Stmt parent nodes inside a BlockDecl.
Fixes rdar://14686900
llvm-svn: 188101
2013-08-09 20:20:25 +00:00
Fariborz Jahanian
261fdb7a9a
ObjectiveC migrator: tighten rule about when to
...
migrate to @property with getter name starting with
'is'.
llvm-svn: 188013
2013-08-08 21:20:01 +00:00
Fariborz Jahanian
cf2ff9ba32
ObjectiveC migration: Handle another special case of
...
setter/getter methods which can be migrated to
a @property.
llvm-svn: 188005
2013-08-08 20:51:58 +00:00
Fariborz Jahanian
cf387c6afb
ObjectiveC migration: tweak setting of lifetime attribute
...
on @property migration. Don't set unsafe_unretained
on non-object properties. Set 'retain' on strong
properties. Makecertain properties with specific
names unsafe_unretained as well.
llvm-svn: 187810
2013-08-06 18:06:23 +00:00
Fariborz Jahanian
9275c688ea
ObjectiveC migrator: Add another family of factory
...
methods which can be migrated to instancetype.
llvm-svn: 187672
2013-08-02 20:54:18 +00:00
Fariborz Jahanian
c4291852a4
ObjectiveC migrator: Fixes public buildbot failures,
...
in my previous patch which was reverted in r187657
llvm-svn: 187661
2013-08-02 18:00:53 +00:00
Fariborz Jahanian
87dc0bc078
revert patch I added in r187655. It still breaks public
...
buildbot.
llvm-svn: 187657
2013-08-02 16:25:41 +00:00
Fariborz Jahanian
11fe914549
ObjectiveC migration. Check-in patch reverted in r187634.
...
Also removed check for "NS" prefix for class name.
llvm-svn: 187655
2013-08-02 16:00:08 +00:00
Rafael Espindola
6cbcc10e84
Revert "ObjectiveC migrator. Migrate to instancetype return type for mehods with certain prefix selector matching their class names' suffix."
...
This reverts commit r187626.
It is breaking the bots.
llvm-svn: 187634
2013-08-02 00:01:14 +00:00
Fariborz Jahanian
8234d40843
ObjectiveC migrator. Migrate to instancetype return type
...
for mehods with certain prefix selector matching their class names'
suffix.
llvm-svn: 187626
2013-08-01 22:29:32 +00:00
Fariborz Jahanian
267bae3ad6
Objective-C migrator: some cleanup.
...
Expose static type of init/alloc/retain with
instance type as well. Ad-hoc cases are coming
next.
llvm-svn: 187068
2013-07-24 19:18:37 +00:00
Fariborz Jahanian
280954a296
ObjectiveC migration: Method candidates for
...
migrating to instancetype can have implicit 'id'
type too.
llvm-svn: 187062
2013-07-24 18:31:42 +00:00
Fariborz Jahanian
631925fe62
ObjectiveC migration: more migration to
...
instancetype of NSDictionary methods.
llvm-svn: 187008
2013-07-23 23:55:55 +00:00
Fariborz Jahanian
670ef26293
ObjectiveC migrator: start migrating to
...
instancetype methods.
llvm-svn: 187004
2013-07-23 23:34:42 +00:00
Fariborz Jahanian
9e543afe19
ObjectiveC migration. Better handle migration to conforming
...
protocols by ignoring cases where all protocol properties
and methods are optional.
llvm-svn: 186895
2013-07-22 23:50:04 +00:00
Fariborz Jahanian
d0f6f79f4e
Objective-C migration: Use NS_OPTIONS when enumerators
...
have shift/bitwise operators or are power of 2.
llvm-svn: 186856
2013-07-22 18:53:45 +00:00
Argyrios Kyrtzidis
ec852d908f
[arcmt] Only disable ARC in the second compilation if there were actually ARC errors in the checking phase.
...
rdar://14490204
llvm-svn: 186850
2013-07-22 18:13:54 +00:00
Fariborz Jahanian
c1c44f62bc
ObjectiveC migrator: Another use case of enum
...
declaration which can be migrated to NS_ENUM.
llvm-svn: 186716
2013-07-19 20:18:36 +00:00
Argyrios Kyrtzidis
47b1517c52
[arcmt] After checking is successful disable auto-synthesize to avoid "@synthesize of 'weak' property is only
...
allowed in ARC" errors.
rdar://14461559
llvm-svn: 186709
2013-07-19 18:57:15 +00:00
Fariborz Jahanian
008ef72bee
Fixes an ObjC migrator crash when last decl
...
in file is an enum.
llvm-svn: 186700
2013-07-19 17:44:32 +00:00
Fariborz Jahanian
b0057bb4fc
ObjectiveC migrator: add support to migrate to
...
NS_OPTIONS.
llvm-svn: 186641
2013-07-19 01:05:49 +00:00
Fariborz Jahanian
85e988bbea
ObjectiveC migrator: Remove semicolon after the typedef
...
declaration when converting to NS_ENUM. This required
some code refactoring.
llvm-svn: 186619
2013-07-18 22:17:33 +00:00
Fariborz Jahanian
92463274e6
ObjectiveC migration. migration to NS_ENUM/SN_OPTION
...
- wip.
llvm-svn: 186604
2013-07-18 20:11:45 +00:00
Fariborz Jahanian
cb7b8deecb
ObjectiveC migrator: When adding conforming protocol,
...
only add outer-most conforming protocols as adding
others are redundant.
llvm-svn: 186473
2013-07-17 00:02:22 +00:00
Fariborz Jahanian
2bc3dda186
ObjectiveC migrator. If a class implements a protocol's
...
properties, then class conforms to that protocol.
llvm-svn: 186460
2013-07-16 21:59:42 +00:00
Fariborz Jahanian
3eb3159816
ObjectiveC migration: complete migrating class
...
declaration to include list of protocols class
conforms to.
llvm-svn: 186443
2013-07-16 18:58:41 +00:00
Fariborz Jahanian
56f48d09f8
ObjC migrator: Improve on hueristics.
...
migrate to 'copy attribute if Object
class implements NSCopying otherwise
assume implied 'strong'. Remove
lifetime qualifier on property as it has
moved to property's attribute. Added TODO
comment for future work by poking into
setter implementation.
llvm-svn: 186037
2013-07-10 21:30:22 +00:00
Fariborz Jahanian
a830ea7431
objc migrator: More refinment of property
...
attributes in migration. Specialli use of
'copy' attribute for retainable object types.
llvm-svn: 185985
2013-07-10 00:20:11 +00:00
Fariborz Jahanian
d83ef848bd
ObjC migrator: Add -objcmt-migrate-property to do property
...
migration. Also, fixes an old bug where older migration
flags were not being checked for properly.
llvm-svn: 185948
2013-07-09 16:59:14 +00:00
Fariborz Jahanian
e61c907792
ObjC migration: more test for migration to
...
properties.
llvm-svn: 185884
2013-07-08 23:29:51 +00:00
Fariborz Jahanian
7ac20e1031
ObjC migration: Skip over setter/getter with attributes
...
for now.
llvm-svn: 185879
2013-07-08 22:49:25 +00:00
Fariborz Jahanian
bfaabe40e7
[Objective-C migrator] replace candidate user setter/getter with
...
their equivalent property declaration. wip.
llvm-svn: 185873
2013-07-08 21:42:08 +00:00
Rafael Espindola
925213b0fa
Add 'not' to commands that are expected to fail.
...
This is at least good documentation, but also opens the possibility of
using pipefail.
llvm-svn: 185652
2013-07-04 16:16:58 +00:00
Argyrios Kyrtzidis
b11a192dfc
[arcmt/driver] For the -ccc-arcmt-* flags, claim them when -fno-objc-arc is passed to avoid the
...
"argument unused during compilation" warning.
rdar://14240566
llvm-svn: 184776
2013-06-24 19:01:18 +00:00
Argyrios Kyrtzidis
bcf2bdc922
Point diagnostics that complain about a use of a selector in an objc message, to the selector location.
...
Previously it would point to the left bracket or the receiver, which can be particularly
problematic if the receiver is a block literal and we end up point the diagnostic far away
for the selector that is complaining about.
rdar://13620447
llvm-svn: 180833
2013-05-01 00:24:09 +00:00
Argyrios Kyrtzidis
501d90bf9f
[objcmt] Fix a mishandled conversion to objc directory literal.
...
rdar://13181413
llvm-svn: 178942
2013-04-06 01:13:17 +00:00
Argyrios Kyrtzidis
d07fabf034
[arcmt] Make sure the function has an associated parameter for the argument
...
before checking for its attributes.
rdar://13192395
llvm-svn: 175184
2013-02-14 17:29:16 +00:00
Argyrios Kyrtzidis
88c0d3b1ae
[arcmt] Make sure the objc migrators work fine when used with a PCH.
...
rdar://13140508
llvm-svn: 174386
2013-02-05 16:37:00 +00:00
Douglas Gregor
0ad84b46e3
Undo my re-wording of the "ARC forbids Objective-C objects in ..."
...
error. Jordan is right.
llvm-svn: 173713
2013-01-28 20:13:44 +00:00
Douglas Gregor
e6c3fa0b27
Forbid the use of objects in unions in Objective-C++ ARC. Fixes
...
<rdar://problem/13098104>.
llvm-svn: 173708
2013-01-28 19:08:09 +00:00
Argyrios Kyrtzidis
6b4f341ecd
[objcmt] Rewrite a NSDictionary dictionaryWithObjects:forKeys: to a dictionary literal
...
if we can see the elements of the arrays.
for example:
NSDictionary *dict = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"1", @"2", nil] forKeys:[NSArray arrayWithObjects:@"A", @"B", nil]];
-->
NSDictionary *dict = @{ @"A" : @"1", @"B" : @"2" };
rdar://12428166
llvm-svn: 172679
2013-01-16 23:54:48 +00:00
Argyrios Kyrtzidis
08281fa337
[arcmt] Follow-up for r171484; make sure when adding brackets enclosing case statements,
...
that the case does not "contain" a declaration that is referenced "outside" of it,
otherwise we will emit un-compilable code.
llvm-svn: 171828
2013-01-08 00:58:25 +00:00
Argyrios Kyrtzidis
d12c332905
[arcmt] Allow removing an -autorelease of a variable initialized in the previous statement.
...
rdar://11074996
llvm-svn: 171485
2013-01-04 18:30:11 +00:00
Argyrios Kyrtzidis
03fbe3ef81
[arcmt] Adds brackets in case statements that "contain" initialization of retaining
...
variable, thus emitting the "switch case is in protected scope" error.
rdar://12952016
llvm-svn: 171484
2013-01-04 18:30:08 +00:00
Argyrios Kyrtzidis
b7b89b5ebc
[arcmt] Don't error if an autoreleased variable is returned after the -autorelease.
...
rdar://12952025
llvm-svn: 171482
2013-01-04 18:29:59 +00:00
Argyrios Kyrtzidis
6ba7afb8e1
[arcmt] Rewrite uses of Block_copy/Block_release macros.
...
c = Block_copy(b);
Block_release(c);
---->
c = [b copy];
<removed>
rdar://9408211
llvm-svn: 171454
2013-01-03 03:17:17 +00:00
Andy Gibbs
0fea04509a
Change VerifyDiagnosticConsumer so that it *must* contain at least one "expected-*" directive. As a result, for test-cases that are not expected to generate any diagnostics, an additional directive "expected-no-diagnostics" has been implemented which can then be included in such test-cases. This new directive may not be used in conjunction with any other "expected-*" directive.
...
This change was initially proposed as a solution to the problem highlighted by check-in r164677, i.e. that -verify will not cause a test-case failure where the compile command does not actually reference the file.
Patch reviewed by David Blaikie.
llvm-svn: 166281
2012-10-19 12:49:32 +00:00
Fariborz Jahanian
35227ea365
objective-C arc: remove -Warc-abi in its entirety.
...
// rdar://10554025
llvm-svn: 163917
2012-09-14 17:48:35 +00:00
Jordan Rose
b00073db80
Update VerifyDiagnosticConsumer to only get directives during parsing.
...
The old behavior was to re-scan any files (like modules) where we may have
directives but won't actually be parsing during the -verify invocation.
Now, we keep the old behavior in Debug builds as a sanity check (though
modules are a known entity), and expect all legitimate directives to come
from comments seen by the preprocessor.
This also affects the ARC migration tool, which captures diagnostics in
order to filter some out. This change adds an explicit cleanup to
CaptureDiagnosticsConsumer in order to let its sub-consumer handle the
real end of diagnostics.
This was originally split into four patches, but the tests do not run
cleanly without all four, so I've combined them into one commit.
Patches by Andy Gibbs, with slight modifications from me.
llvm-svn: 161650
2012-08-10 01:06:16 +00:00
Fariborz Jahanian
b7f03c191c
objective-c arc: ARC IRGen correctly assumes result
...
type of generated call to super dealloc is 'void'
and asserts if user's dealloc is not of 'void type.
This rule must be enforced in clang front-end (with a
fixit) if this is not the case, instead of asserting in CodeGen.
// rdar://11987838
llvm-svn: 160993
2012-07-30 20:52:48 +00:00
Fariborz Jahanian
84c97cafd0
revert r160839 for now.
...
llvm-svn: 160895
2012-07-27 21:34:23 +00:00
Fariborz Jahanian
226459efff
objc-arc: When objects with known CF semantics are assigned to
...
retainable types in arc, only suggest CFBridgingRelease/
CFBridgingRetain and not the confusing __bridge casts.
// rdar://11923822
llvm-svn: 160839
2012-07-26 23:17:04 +00:00
Nico Weber
9035951409
Let Expr::HasSideEffects() return false for NULL, bool literals, this, and nullptr.
...
Fixes PR13413, -Wunused-private-field now warns on unused fields initialized to NULL.
llvm-svn: 160541
2012-07-20 03:39:05 +00:00
Argyrios Kyrtzidis
89b928eb6a
[objcmt] Check for classes that accept 'objectForKey:' (or the other selectors
...
that the migrator handles) but return their instances as 'id', resulting
in the compiler resolving 'objectForKey:' as the method from NSDictionary.
When checking if we can convert to subscripting syntax, check whether
the receiver is a result of a class method from a hardcoded list of
such classes. In such a case return the specific class as the interface
of the receiver.
llvm-svn: 159788
2012-07-06 00:07:09 +00:00
Argyrios Kyrtzidis
13b92929dc
[objcmt] Allow migrating to subscripting syntax for other classes
...
(apart from NSDictionary/NSArray) that implement objectForKey:/objectAtIndex/etc.
and the subscripting methods as well.
Part of rdar://11734969
llvm-svn: 159783
2012-07-05 21:49:51 +00:00
Fariborz Jahanian
450bb6e8ff
objective-c: Refactor parse/sema portion of
...
objective-c's fast enumeration statement,
for more work to come.
llvm-svn: 159689
2012-07-03 22:00:52 +00:00
Argyrios Kyrtzidis
927a437ac7
[objcmt] Have the modern objc migration warning change from:
...
[NSNumber numberWithDouble:cppb];
warning: converting to boxing syntax requires a cast
to something like:
[NSNumber numberWithDouble:cppb];
warning: converting to boxing syntax requires casting 'bool' to 'double'
This is way better to fully understand the warning.
rdar://11705106
llvm-svn: 158783
2012-06-20 01:28:32 +00:00
Argyrios Kyrtzidis
692bf8cb64
[arcmt] When migrating to ARC disable -Werror so as to only block migration
...
for "hard" ARC errors, not warnings.
rdar://11691437
llvm-svn: 158781
2012-06-20 01:10:40 +00:00
Argyrios Kyrtzidis
a3fcbeb908
[objcmt] When checking whether the subscripting methods are declared use
...
ObjCInterfaceDec::lookupInstanceMethod to make sure we check categories as well
and update related tests.
rdar://11695288
llvm-svn: 158697
2012-06-19 02:22:02 +00:00
Argyrios Kyrtzidis
b03cc793a9
[arcmt] At an unbridged cast error, if we're returning a load-of-ivar from a +0 method,
...
automatically insert a __bridge cast.
radar://11560638
llvm-svn: 158127
2012-06-07 00:44:06 +00:00
Argyrios Kyrtzidis
63aebfb4ae
[objcmt] When in ARC mode, also convert "[[.. alloc] init]" messages to literals,
...
since the change from +1 to +0 will be handled fine by ARC.
rdar://11606358
llvm-svn: 158114
2012-06-06 22:23:12 +00:00
Fariborz Jahanian
3da28f80e3
objective-c: merge deprecated/unavailable attributes to
...
the overriding deprecated/unavailable method.
// rdar://11475360
llvm-svn: 158022
2012-06-05 21:14:46 +00:00
Argyrios Kyrtzidis
6310fdd982
[objcmt] Don't migrate to subscripting syntax if the required methods have not
...
been declared on NSArray/NSDictionary.
rdar://11581975
llvm-svn: 157951
2012-06-04 21:23:26 +00:00
Argyrios Kyrtzidis
273c7c40b2
[arcmt] Use CFBridgingRetain/CFBridgingRelease instead of __bridge_retained/__bridge_transfer
...
when migrating.
rdar://11569198
llvm-svn: 157785
2012-06-01 00:10:47 +00:00
Argyrios Kyrtzidis
bb2be0dca3
[objcmt] Add test case for r157395.
...
llvm-svn: 157404
2012-05-24 17:49:22 +00:00
Argyrios Kyrtzidis
0b21d82437
[arcmt] Remove an unused -autorelease, without failing with error, for this
...
idiom that is used commonly in setters:
[backingValue autorelease];
backingValue = [newValue retain]; // in general a +1 assign
rdar://9914061
llvm-svn: 157347
2012-05-23 21:50:04 +00:00
Argyrios Kyrtzidis
94442980c0
[objcmt] Don't add redundant parentheses when migrating subscripting of an ivar.
...
rdar://11501256
llvm-svn: 157227
2012-05-22 00:47:53 +00:00
Argyrios Kyrtzidis
937bcb2de6
[arcmt] Revert r156999 "Remove the "it is not safe to remove an unused 'autorelease' message" ARC
...
migration error".
Per feedback from John this is useful to have in general.
llvm-svn: 157198
2012-05-21 17:48:31 +00:00
Argyrios Kyrtzidis
3d6439517c
[arcmt] Remove the "it is not safe to remove an unused 'autorelease' message" ARC
...
migration error.
This is more trouble that it is worth; autoreleasing a value without holding on it
is a valid use-case, we should not "punish" correct code for the minority of
broken/fragile programs that depend on the behavior of -autorelease.
rdar://9914061
llvm-svn: 156999
2012-05-17 18:16:05 +00:00
Argyrios Kyrtzidis
8154147942
[objcmt] Accept char arrays for rewriting to @() syntax.
...
Part of rdar://11438360
llvm-svn: 156880
2012-05-16 00:21:21 +00:00
Argyrios Kyrtzidis
7bd957c12a
[objcmt] Rewrite messages to NSString's stringWithUTF8String:/stringWithCString:
...
to use the @() boxing syntax.
It will also rewrite uses of stringWithCString:encoding: where the encoding that is
used is NSASCIIStringEncoding or NSUTF8StringEncoding.
rdar://11438360
llvm-svn: 156868
2012-05-15 22:22:10 +00:00
Argyrios Kyrtzidis
491e4aed31
[objcmt] Rewrite [NSNumber numberWith*] messages to the new @() boxing syntax.
...
There are some caveats:
-If an implicit cast (e.g. int -> float for numberWithFloat:) was required, the message
will not get rewritten
-If the message was with numberWithInteger:/numberWithUnsignedInteger:, which are very
commonly used, be more liberal and allow the boxing syntax if the underlying type has
same signedness and will not lose precision.
Part of rdar://11438360
llvm-svn: 156844
2012-05-15 19:17:49 +00:00
Argyrios Kyrtzidis
0bbe94f737
[objcmt] When rewriting to subscripting syntax, make sure we put
...
the receiver in parentheses when necessary.
Part of rdar://11438360
llvm-svn: 156789
2012-05-14 23:33:49 +00:00
Argyrios Kyrtzidis
c1dfed6572
[objcmt] When rewriting to array/dictionary literals, add an explicit
...
cast to 'id' for any argument that requires it.
Part of rdar://11438360.
llvm-svn: 156782
2012-05-14 22:01:53 +00:00
Argyrios Kyrtzidis
a9151a5170
[arcmt] When fixing the "unassigned init call" ARC error, make sure
...
to do a nil check for the result of the call.
rdar://10950973
llvm-svn: 153793
2012-03-31 01:34:06 +00:00
Argyrios Kyrtzidis
28e0a7f6c1
[arcmt] Fix a bug where a property in a class extension, that did not exist
...
in the interface, got its attribute rewritten twice, resulting in
'weakweak' or 'strongstrong'.
rdar://11047179
llvm-svn: 153621
2012-03-29 01:10:31 +00:00
Ted Kremenek
4a64230ee7
Don't include FixIts with a null replacement range. Fixes <rdar://problem/11040133>.
...
llvm-svn: 153122
2012-03-20 20:49:45 +00:00
Argyrios Kyrtzidis
5652716a7a
[objcmt] Add a triple to test/ARCMT/objcmt-subscripting-literals.m
...
llvm-svn: 152151
2012-03-06 22:03:39 +00:00
Ted Kremenek
f7639e1b4a
Add new code migrator support for migrating existing Objective-C code to use
...
the new Objective-C NSArray/NSDictionary/NSNumber literal syntax.
This introduces a new library, libEdit, which provides a new way to support
migration of code that improves on the original ARC migrator. We now believe
that most of its functionality can be refactored into the existing libraries,
and thus this new library may shortly disappear.
llvm-svn: 152141
2012-03-06 20:06:33 +00:00
Argyrios Kyrtzidis
afdc66f4fa
[arcmt]
...
-Make sure we don't change to '__weak' a __block variable used as output.
-Make sure we don't apply __weak twice.
Fixes rdar://10520757&10521362
llvm-svn: 152020
2012-03-05 08:46:24 +00:00
Argyrios Kyrtzidis
01c047e003
[arcmt] GC migrator: don't try to remove redundant __strong, it does
...
more harm than good.
Fixes rdar://10522805&10521433
llvm-svn: 151424
2012-02-25 01:57:42 +00:00
Ted Kremenek
6eb25628c5
Revert r145999. This turned out to be a bad idea. Unfortunately, 'id' is used so profusely
...
in many APIs and large codebases that this made the deprecated warning trigger happy to
the point of not being useful.
llvm-svn: 150223
2012-02-10 02:45:47 +00:00
Fariborz Jahanian
30febeb224
Look for declaration of CFBridgingRetain/CFBridgingRetain before
...
changing the diagnostic. Also use correct spelling for both.
llvm-svn: 149554
2012-02-01 22:56:20 +00:00
Fariborz Jahanian
bcdc282d85
objc-arc: In various diagnostics mention
...
CFBridgingRetain/CFBridgingRelease calls instead
of __bridge_retained/__bridge_transfer casts as preferred
way of moving cf objects to arc land. // rdar://10207950
llvm-svn: 149449
2012-01-31 23:42:37 +00:00
Fariborz Jahanian
a1c1b152f0
arc migrator: twik previous patch to exclude user provided
...
explicit type cast. // rdar://10521744
llvm-svn: 149437
2012-01-31 22:09:44 +00:00
Fariborz Jahanian
eb00284f22
arc migrator: Do not attempt to migrate to bridge casts which
...
cancel out each other. Leave it alone so users can take a look
(unmigrated code forces error diagnostic). // rdar://10521744
llvm-svn: 149435
2012-01-31 21:58:23 +00:00
Fariborz Jahanian
48fd81b484
objc-arc: introduce -no-finalize-removal which in gc mode,
...
leaves "finalize' behind and in arc mode, does not
include it. This allows the migrated source to be compiled
in both gc and arc mode. // rdar://10532441
llvm-svn: 149079
2012-01-26 20:57:58 +00:00
Fariborz Jahanian
aa7b9aa10d
arc migrator: Provide infrastructure to add options
...
specific to migrator. Use its first option to
warn migrating from GC to arc when
NSAllocateCollectable/NSReallocateCollectable is used.
// rdar://10532541
llvm-svn: 148887
2012-01-25 00:20:29 +00:00
Fariborz Jahanian
1630c15b0f
arg migrator: change all "assign" of object properties
...
to "strong" when migrating from GC. // rdar://10532449
llvm-svn: 148607
2012-01-21 00:43:53 +00:00
Sebastian Pop
422377cfd3
rename -ccc-host-triple into -target
...
llvm-svn: 148582
2012-01-20 22:01:23 +00:00
Fariborz Jahanian
9652adf2af
arc migrator: replace "retain" attribute with "strong"
...
which have same semantics in mrr as well as arr.
// rdar://10688312
llvm-svn: 148559
2012-01-20 19:15:02 +00:00
Eli Friedman
d749c6bf2e
Revert r148138; it's causing test failures.
...
llvm-svn: 148141
2012-01-13 21:33:06 +00:00
Sebastian Pop
9a8d528ddf
rename -ccc-host-triple into -target
...
llvm-svn: 148138
2012-01-13 20:37:02 +00:00
Argyrios Kyrtzidis
7e79129d15
[arcmt] The migrator tests for the buildbot in http://lab.llvm.org:8011/builders/clang-native-mingw32-win7/
...
are messed up, XFAIL does not help. Waiting until DISABLE is supported..
llvm-svn: 148012
2012-01-12 02:34:32 +00:00
Argyrios Kyrtzidis
33976a6365
[arcmt] XFAIL on mingw.
...
llvm-svn: 147830
2012-01-10 02:39:29 +00:00
Argyrios Kyrtzidis
10398a3789
[arcmt] Disable tests in mingw, no idea why they are failing there.
...
llvm-svn: 147713
2012-01-07 02:24:23 +00:00
Richard Trieu
553b2b2e5d
Modify how the -verify flag works. Currently, the verification string and
...
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
2011-12-15 00:38:15 +00:00
Argyrios Kyrtzidis
c5dbeeadc1
[arcmt] Un-XFAIL a test.
...
llvm-svn: 146210
2011-12-09 00:17:47 +00:00
Argyrios Kyrtzidis
7910d7b72a
Make changes to SDiagsWriter to make it work in combination with the ARC 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
2011-12-07 05:52:12 +00:00
Fariborz Jahanian
6bdeb14d5d
objc: issue deprecated/unavailable diagnostic when
...
methods with these attributes are sent to receivers
of 'id' type too. // rdar://10459930
llvm-svn: 145999
2011-12-07 00:30:00 +00:00
Argyrios Kyrtzidis
eca1f36a54
[arcmt] Integrate GC __weak into property attributes even when we don't have
...
the implementation.
llvm-svn: 145224
2011-11-28 02:04:36 +00:00
Argyrios Kyrtzidis
3fc3dcd80f
[arcmt] Don't add __weak if there is already a GC __weak and make sure to clear
...
__weak from a readonly property.
llvm-svn: 145210
2011-11-28 00:23:12 +00:00
Argyrios Kyrtzidis
485eceed38
[arcmt] Take into account that all properties are strong-by-default now and fix the test.
...
llvm-svn: 144146
2011-11-08 23:09:34 +00:00
Argyrios Kyrtzidis
e4a38a73fd
[arcmt] Now that readonly properties are strong-by-default, do not add redundant 'strong'.
...
llvm-svn: 144136
2011-11-08 22:10:58 +00:00
Fariborz Jahanian
b1ac0813a6
objc-arc: 'readonly' property of retainable object
...
type is strong by default too. // rdar://10410903
llvm-svn: 144118
2011-11-08 20:58:53 +00:00
Argyrios Kyrtzidis
dbe077a89d
[arcmt] Now that properties are strong by default, avoid adding redundant '(strong)'
...
property attribute.
llvm-svn: 144078
2011-11-08 05:56:11 +00:00
Argyrios Kyrtzidis
2519a0801f
[arcmt] When we already removed a __weak, don't try to change it to __unsafe_unretained
...
later on, or we will end up with a redundant '__unsafe_unretained'.
llvm-svn: 144059
2011-11-08 02:02:38 +00:00
Argyrios Kyrtzidis
d569791c44
[arcmt] Fix handling NSMakeCollectable inside an objc method.
...
llvm-svn: 143980
2011-11-07 18:46:50 +00:00
Argyrios Kyrtzidis
722d21c646
[arcmt] In GC, handle (assign) @properties.
...
-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
2011-11-07 18:46:46 +00:00
Argyrios Kyrtzidis
e80d4f228c
[arcmt] In GC, change '__weak' -> '__unsafe_unretained' when applied
...
to objects of classes that don't support ARC weak
llvm-svn: 143976
2011-11-07 18:40:29 +00:00
Argyrios Kyrtzidis
f233dac67c
[arcmt] In GC, error for __strong/__weak on non-objc pointers.
...
llvm-svn: 143887
2011-11-06 18:58:23 +00:00
Argyrios Kyrtzidis
0c233fa23e
[arcmt] In GC, clear redundant __strong's.
...
llvm-svn: 143886
2011-11-06 18:58:17 +00:00
Argyrios Kyrtzidis
6b2d47d829
[arcmt] In GC, error out when there is a call that returns a pointer to
...
GC managed non-objc object memory.
llvm-svn: 143747
2011-11-04 23:43:03 +00:00
Argyrios Kyrtzidis
d2b9112354
[arcmt] For GC, cleanup and turn -finalize to -dealloc.
...
llvm-svn: 143701
2011-11-04 15:58:22 +00:00
Argyrios Kyrtzidis
d8cdfbc905
[arcmt] In GC, error for use of CFMakeCollectable because it will leak the
...
object that it receives in ARC.
llvm-svn: 143700
2011-11-04 15:58:17 +00:00
Argyrios Kyrtzidis
3eaa22af57
In C++ keep unavailable function calls in the AST, like in C/ObjC.
...
This allows the migrator to visit and fix them.
llvm-svn: 143699
2011-11-04 15:58:13 +00:00
Argyrios Kyrtzidis
d208ef95aa
[arcmt] In GC, transform NSMakeCollectable to CFBridgingRelease.
...
llvm-svn: 143698
2011-11-04 15:58:08 +00:00
Ted Kremenek
337c5b880c
Further refine the diagnostic categories for ARC diagnostics. Addresses <rdar://problem/10245086>.
...
llvm-svn: 142571
2011-10-20 05:07:47 +00:00
Argyrios Kyrtzidis
05c65fbdb6
[arcmt] Rewrite attributes in extensions as well. rdar://9992142
...
llvm-svn: 142407
2011-10-18 19:49:19 +00:00
Argyrios Kyrtzidis
ffe8b1c7be
[arcmt] In ARC default for properties is 'strong' so just remove a 'retain' if possible,
...
instead of changing it to 'strong'. rdar://9984862.
llvm-svn: 142304
2011-10-17 23:14:16 +00:00
John McCall
4124c4924d
Teach the ARC compiler to not require __bridge casts when
...
passing/receiving CF objects at +0 to/from Objective-C methods
or audited C functions.
llvm-svn: 142219
2011-10-17 18:40:02 +00:00
Argyrios Kyrtzidis
f8585fbe57
Try fixing windows bots.
...
llvm-svn: 141462
2011-10-08 00:54:49 +00:00
Argyrios Kyrtzidis
741fab1358
[arcmt] Ignore linking errors when doing ARC migration, rdar://10247606
...
llvm-svn: 141434
2011-10-07 22:58:08 +00:00
John McCall
9b0a7cea0f
Make -fobjc-nonfragile-abi the -cc1 default, since it's the
...
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
2011-10-02 01:16:38 +00:00
Argyrios Kyrtzidis
41899f3bac
[arcmt] Use __bridge_retained when passing an objc object to a CF parameter
...
annotated with cf_consumed attribute.
llvm-svn: 139709
2011-09-14 18:17:09 +00:00
Argyrios Kyrtzidis
37ad0091c3
[arcmt] Try fixing the windows buildbot.
...
llvm-svn: 139262
2011-09-07 21:50:18 +00:00
Argyrios Kyrtzidis
9d4fac0f9f
[arcmt] Remove xfail on test for windows, Takumi reported that it passes mingw and msvc.
...
llvm-svn: 139223
2011-09-07 03:43:41 +00:00
Argyrios Kyrtzidis
48d7798de1
[arcmt] Clear out temporary dirs in the tests or we may get failures because of leftovers.
...
llvm-svn: 138971
2011-09-01 21:53:39 +00:00