Commit Graph

91 Commits

Author SHA1 Message Date
Fariborz Jahanian 1c900bcf26 ObjectiveC migrator: For consistency, also infer
'instancetype' for known family of methods
with related result type; such as 'init'
methods. // rdar://14987948

llvm-svn: 190956
2013-09-18 20:35:47 +00:00
Fariborz Jahanian 2ba62a7206 ObjectiveC migrator: Infer property in the presense
of methods annotated with attributes. 
// rdar://14987909

llvm-svn: 190947
2013-09-18 17:22:25 +00:00
Fariborz Jahanian e47a14addc ObjectiveC migrator: placing another check for
'deprecated' container before doing the 'instancetype'
inference.

llvm-svn: 190943
2013-09-18 15:43:52 +00:00
Fariborz Jahanian 6e1798e36a ObjectiveC migrator. infer NS_OPTIONS correctly in the
presense of parenthesized enumerator initializers.

llvm-svn: 190901
2013-09-17 23:32:51 +00:00
Fariborz Jahanian f6c6505eaa ObjectiveC migrator: Don't infer property from
'deprected' setters either. // rdar://14989365

llvm-svn: 190894
2013-09-17 22:41:25 +00:00
Fariborz Jahanian 75226d5c0d ObjectiveC migrator. Ignore migrating 'deprecated'
entities. // rdar://14989365

llvm-svn: 190890
2013-09-17 21:56:04 +00:00
Fariborz Jahanian 4c3d9c5e24 ObjectiveC migrator: Don't infer a property from isXXX method
of retainable object (readonly or otherwise).

llvm-svn: 190881
2013-09-17 19:38:55 +00:00
Fariborz Jahanian 92f7242a56 ObjectiveC migrator. Infer property in categories
declared as getter with or without setter method.
// rdar://15010020

llvm-svn: 190878
2013-09-17 19:00:30 +00:00
Fariborz Jahanian 47502c11f5 ObjectiveC migration. NS_RETURNS_NOT_RETAINED is the default for
unknown methods which return Cocoa objects. No need to annotate
such methods.

llvm-svn: 190555
2013-09-11 22:46:09 +00:00
Fariborz Jahanian 34fea36340 ObjectiveC migrator. Modify inferred property name
such that it does not lower case the staring property
name if getter name (after "get" prefix) starts with 
two upper case letters.

llvm-svn: 190539
2013-09-11 18:27:16 +00:00
Fariborz Jahanian ca39960f31 ObjectiveC migrator. methods which look like a getter and
start with "get" are inferreed as a readonly properties.

llvm-svn: 190532
2013-09-11 17:05:15 +00:00
Fariborz Jahanian c02bfb9a85 ObjectiveC migrator: rename inferred isXXX property,
with a suitable 'getter' attribute.

llvm-svn: 190420
2013-09-10 18:39:32 +00:00
Fariborz Jahanian 9d5fffb425 ObjectiveC migrator. Do not infer NS_RETURNS_INNER_POINTER
annotation on methods which return typedef of pointer to 
an incomplete struct type.

llvm-svn: 190372
2013-09-09 23:56:14 +00:00
Fariborz Jahanian 215f96c084 ObjectiveC migrator: When inferring a property,
preserve getter's attribute. Also, do not attach
an inferred NS_RETURNS_INNER_POINTER to the inferred
property (it is illegal).

llvm-svn: 190223
2013-09-06 23:45:20 +00:00
Fariborz Jahanian c24879e2de ObjectiveC migrator: tighten the rules for when
inferring NS_RETURNS_RETAINED, etc., return annotations.
Do not infer if these annotations are implicit
from the naming convention. Also add inference for
NS_CONSUMES_SELF annotation.

llvm-svn: 190106
2013-09-05 23:04:33 +00:00
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 8b10230f54 ObjectiveC migrator. Refactor last patch on
annotations. (was r189892).

llvm-svn: 189956
2013-09-04 16:43:57 +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 4ccdc73f44 ObjectiveC migrator: remove dead code.
llvm-svn: 189592
2013-08-29 16:22:26 +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 7ca1d30e49 ObjectiveC migrator: minor refactoring of my last
cf annotation patch.

llvm-svn: 189420
2013-08-27 23:56:54 +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
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 4f64dd2baf ObjectiveC migrator: some refactoring to reduce
code size.

llvm-svn: 189070
2013-08-22 21:40:15 +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 b834352609 ObjectiveC migrator. make sure to embed audited
candidate functions in their CF_IMPLICIT_BRIDGING_ENABLED
pragma before exiting the header file.

llvm-svn: 188846
2013-08-20 23:35:26 +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 d38ad47cfa ObjectiveC migrator: More work towards
insertion of ObjC audit pragmas.

llvm-svn: 188733
2013-08-20 00:07:23 +00:00
Fariborz Jahanian c6dfd3f8f2 ObjectiveC migrator: Start inserting
CF_IMPLICIT_BRIDGING_ENABLE/CF_IMPLICIT_BRIDGING_DISABLED
pair. wip.

llvm-svn: 188714
2013-08-19 22:00:50 +00:00
Fariborz Jahanian 9ef4a26de8 ObjectiveC migrator. Start auditing CF functions
for possible use of CF_IMPLICIT_BRIDGING_ENABLE
pragma.

llvm-svn: 188691
2013-08-19 19:13:34 +00:00
Fariborz Jahanian 2ec4d7ba07 ObjectiveC migrator: Add some more routines
for future work. No change otherwise.

llvm-svn: 188591
2013-08-16 23:35:05 +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 0b48e7c6bd Fixes a gross conditional in my last patch.
- This line, and those below, will be ignored--

M    lib/ARCMigrate/ObjCMT.cpp

llvm-svn: 188473
2013-08-15 18:58:00 +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
Fariborz Jahanian dfe6ed9660 ObjectiveC migration. Add couple of routine
, currently unused, for future cf-annotation work.

llvm-svn: 188224
2013-08-12 23:17:13 +00:00
Fariborz Jahanian db8bf8313a unbreak buildbot on Windows.
llvm-svn: 188018
2013-08-08 21:51:06 +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 3bfc35e26a ObjectiveC migrator. Differentiate 'instancetype'
from 'id' result type when deciding on migration
to instancetype.

llvm-svn: 187684
2013-08-02 22:34:18 +00:00