Commit Graph

461 Commits

Author SHA1 Message Date
Aaron Ballman dc4bea4676 [C++11] Replacing ObjCContainerDecl iterators prop_begin() and prop_end() with iterator_range props(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203830
2014-03-13 18:47:37 +00:00
Aaron Ballman 2b124d1a5d [C++11] Replacing CXXRecordDecl iterators method_begin() and method_end() with iterator_range methods(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203812
2014-03-13 16:36:16 +00:00
Ahmed Charles af94d56b56 [C++11] Remove the remaining uses of OwningPtr.
Replace OwningArrayPtr with std::unique_ptr<T[]>.

llvm-svn: 203388
2014-03-09 11:34:25 +00:00
Aaron Ballman 23a6dcb365 [C++11] Replacing EnumDecl iterators enumerator_begin() and enumerator_end() with iterator_range enumerators(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203353
2014-03-08 18:45:14 +00:00
Ahmed Charles b89843299a Replace OwningPtr with std::unique_ptr.
This compiles cleanly with lldb/lld/clang-tools-extra/llvm.

llvm-svn: 203279
2014-03-07 20:03:18 +00:00
Ahmed Charles 9a16beb8bc Change OwningPtr::take() to OwningPtr::release().
This is a precursor to moving to std::unique_ptr.

llvm-svn: 203275
2014-03-07 19:33:25 +00:00
Aaron Ballman 86c9390673 [C++11] Replacing iterators redecls_begin() and redecls_end() with iterator_range redecls(). Updating all of the usages of the iterators with range-based for loops, which allows the begin/end forms to be removed entirely.
llvm-svn: 203179
2014-03-06 23:45:36 +00:00
Benjamin Kramer 867ea1d426 [C++11] Replace llvm::tie with std::tie.
llvm-svn: 202639
2014-03-02 13:01:17 +00:00
Chandler Carruth c72d9b33af [C++11] Switch from the llvm_move macro to directly calling std::move.
llvm-svn: 202611
2014-03-02 04:02:40 +00:00
NAKAMURA Takumi 9698686505 [CMake] Use LINK_LIBS instead of target_link_libraries().
llvm-svn: 202238
2014-02-26 06:41:29 +00:00
Rafael Espindola 4fbd373815 Update for llvm api change.
llvm-svn: 202053
2014-02-24 18:20:21 +00:00
Rafael Espindola 04a13befd8 Don't assume that F_None is the default. It is about to change.
llvm-svn: 202040
2014-02-24 15:06:52 +00:00
NAKAMURA Takumi 7da9487dd4 [CMake] Get rid of explicit dependencies to include/clang/*.inc and introduce CLANG_TABLEGEN_TARGETS.
This does;
  - clang_tablegen() adds each tblgen'd target to global property CLANG_TABLEGEN_TARGETS as list.
  - List of targets is added to LLVM_COMMON_DEPENDS.
  - all clang libraries and targets depend on generated headers.

You might wonder this would be regression, but in fact, this is little loss.
  - Almost all of clang libraries depend on tblgen'd files and clang-tblgen.
  - clang-tblgen may cause short stall-out but doesn't cause unconditional rebuild.
  - Each library's dependencies to tblgen'd files might vary along headers' structure.
    It made hard to track and update *really optimal* dependencies.

Each dependency to intrinsics_gen and ClangSACheckers is left as DEPENDS.

llvm-svn: 201842
2014-02-21 07:59:59 +00:00
Rafael Espindola 30b8bf7dbf Use simpler version of fs::create_directory.
llvm-svn: 201293
2014-02-13 04:22:54 +00:00
Alp Toker 29cb66ba2f Enforce safe usage of DiagnosticsEngine::getCustomDiagID()
Replace the last incorrect uses and templatize the function to require a
compile-time constant string preventing further misuse.

The diagnostic formatter expects well-formed input and has undefined behaviour
with arbitrary input or crafted user strings in source files. Accepting user
input would also have caused unbounded generation of new diagnostic IDs which
can be problematic in long-running sessions or language bindings.

This completes the work to fix several incorrect callers that passed user
input or raw messages to the diagnostics engine where a constant format string
was expected.

llvm-svn: 200132
2014-01-26 06:17:37 +00:00
Alp Toker 046cda538c Identify two more unsafe uses of getCustomDiagID()
llvm-svn: 200126
2014-01-26 05:08:49 +00:00
Alp Toker 42aa21222d ARCMigrate: Introduce proper diagnostics for TransformActions
This starts to switch ARCMT to use proper diagnostic messages. The old use was
based on incorrect example code from the documentation.

The logic of the previous report() functions has been retained to support any
external consumers that might be intercepting diagnostic messages through the
old interface.

Note that the change in test/Misc/warning-flags.c isn't a new warning without a
flag, rather one that was previously invisible to the test. Adding a flag might
be a good idea though.

llvm-svn: 200124
2014-01-26 05:07:32 +00:00
Alp Toker 314cc81b8c Rename getResultType() on function and method declarations to getReturnType()
A return type is the declared or deduced part of the function type specified in
the declaration.

A result type is the (potentially adjusted) type of the value of an expression
that calls the function.

Rule of thumb:

  * Declarations have return types and parameters.
  * Expressions have result types and arguments.

llvm-svn: 200082
2014-01-25 16:55:45 +00:00
Alp Toker 48047f5d75 PlistSupport: Eliminate duplicated EmitLocation() and EmitRange() functions
llvm-svn: 200077
2014-01-25 14:38:41 +00:00
Alp Toker bdbcfbf160 PlistSupport: Unify ARCMigrate / StaticAnalyzer plist writers
Reduces the ARCMT migrator plist writer down to a single function,
arcmt::writeARCDiagsToPlist() which shares supporting functions with the
analyzer plist writer.

llvm-svn: 200075
2014-01-25 11:14:41 +00:00
Rafael Espindola 2a008784d3 Use the simpler version of llvm::sys::fs::remove when possible.
llvm-svn: 198957
2014-01-10 21:32:14 +00:00
Chandler Carruth 5553d0d4ca Sort all the #include lines with LLVM's utils/sort_includes.py which
encodes the canonical rules for LLVM's style. I noticed this had drifted
quite a bit when cleaning up LLVM, so wanted to clean up Clang as well.

llvm-svn: 198686
2014-01-07 11:51:46 +00:00
Aaron Ballman 9ead1243a5 Replacing calls to getAttr with calls to hasAttr for clarity. No functional change intended -- this only replaces Boolean uses of getAttr.
llvm-svn: 197648
2013-12-19 02:39:40 +00:00
Fariborz Jahanian 769c04ea35 ObjectiveC migrator. Fixes a bug when protocol
conformance is inferred. // rdar://15515206

llvm-svn: 197448
2013-12-17 01:01:33 +00:00
Hans Wennborg bf6dda5116 Re-apply r197076 and r197086; the build was fixed by chapuni in r197114.
llvm-svn: 197116
2013-12-12 02:24:20 +00:00
Hans Wennborg 69a458f690 Revert r197076: "[objcmt] When emitting a remap file, use a json format
with the edit entries, instead of applying the changes"

(And also revert the follow-up r197086.)

This seems to have broken Linux builds, which were failing with the following:

/build/buildbot/osu8/clang-x86_64-linux-selfhost-rel/llvm.obj/Release+Asserts/lib/libclang.so:
error: undefined reference to
'clang::ento::objc_retain::CallEffects::getEffect(clang::ObjCMethodDecl const*)'
/build/buildbot/osu8/clang-x86_64-linux-selfhost-rel/llvm.obj/Release+Asserts/lib/libclang.so:
error: undefined reference to
'clang::ento::objc_retain::CallEffects::getEffect(clang::FunctionDecl const*)'
collect2: error: ld returned 1 exit status

llvm-svn: 197111
2013-12-12 02:12:17 +00:00
Fariborz Jahanian 49e69ee557 Objective-C migrator: when inferring 'readonly' property of an
Objective-C object conforming to 'NSCopying' protocol, infer
a 'copy' property, instead of 'strong'. // rdar://15525937

llvm-svn: 197102
2013-12-12 01:02:00 +00:00
Alp Toker 7afe9908d2 Remove extra qualification to fix build with g++ after r197076
llvm-svn: 197086
2013-12-11 22:50:04 +00:00
Argyrios Kyrtzidis 712e18a0c1 [objcmt] When emitting a remap file, use a json format with the edit entries, instead of applying the changes
to a temp file directly.

This allows to combine the edits when they can be different based on whether you saw
the implementation or not, e.g. with the designated initializer migration.

llvm-svn: 197076
2013-12-11 21:39:06 +00:00
Argyrios Kyrtzidis 3f72934bba [objcmt] When whitelisting the headers we want to modify, allow changing the
the ObjC implementation declarations, just don't change implementations for
classes that are not in the whitelisted headers.

For example, if we change a method to return 'instancetype' we should also
update the method definition in the implementation.

llvm-svn: 197075
2013-12-11 21:39:00 +00:00
Argyrios Kyrtzidis 4f2ecc6177 [objcmt] Add a modernization option to infer and suggest designated initializers.
rdar://15509284

llvm-svn: 196943
2013-12-10 18:36:49 +00:00
NAKAMURA Takumi ebde2aef9f [CMake] clang/lib: Prune redundant dependencies.
llvm-svn: 196864
2013-12-10 02:36:22 +00:00
NAKAMURA Takumi 65d42bcc2b [CMake] clang/lib: Satisfy dependencies to add *actually used* libraries on target_link_libraries() and LLVM_LINK_COMPONENTS.
I will prune redundant dependencies later.

llvm-svn: 196800
2013-12-09 19:04:43 +00:00
Alp Toker f6a24ce40f Fix a tranche of comment, test and doc typos
llvm-svn: 196510
2013-12-05 16:25:25 +00:00
Fariborz Jahanian d9aef7883d ObjectiveC migrator. delegate property must be
inferred as 'assign', not 'assign' and 'strong'.
// rdar://15509831

llvm-svn: 195368
2013-11-21 17:49:34 +00:00
Fariborz Jahanian 54c8eaad90 ObjectiveC migrator. use strong instead of
retain attribute for inferred properties.
// rdar://15519923

llvm-svn: 195292
2013-11-21 00:58:17 +00:00
Fariborz Jahanian 48a44d4621 ObjectiveC migrator. Do not migrate categories with
'Deprecated' name suffix.

llvm-svn: 195137
2013-11-19 18:17:31 +00:00
Fariborz Jahanian da267d0551 ObjectiveC migrator: This patch sets access property
attributes on 'readonly' properties. // rdar://15460787

llvm-svn: 194718
2013-11-14 18:28:58 +00:00
Argyrios Kyrtzidis 61f2032d3b [objcmt] Introduce "objcmt-white-list-dir-path=" option.
This options accepts a path to a directory, collects the filenames of the files
it contains, and the migrator will only modify files with the same filename.

llvm-svn: 194710
2013-11-14 16:33:29 +00:00
Argyrios Kyrtzidis c47c63b2dd [objcmt] -objcmt-atomic-property & -objcmt-ns-nonatomic-iosonly are companion flags.
Ignore them when determining if some transformation was enabled.

llvm-svn: 194709
2013-11-14 16:33:20 +00:00
Argyrios Kyrtzidis ee02a8a926 [objcmt] If no objcmt options were specified, default to enable literals+subscripting.
llvm-svn: 194629
2013-11-13 23:38:22 +00:00
Argyrios Kyrtzidis 55ecf99285 [objcmt] Transfer the objcmt flags from the driver to cc1 invocation and
instantiate ObjCMigrateASTConsumer with the specific options that were enabled.

llvm-svn: 194628
2013-11-13 23:38:20 +00:00
Argyrios Kyrtzidis 3e8547a5ca [objcmt] Use FileIDs directly instead of their hash value.
No functionality change.

llvm-svn: 194590
2013-11-13 18:20:31 +00:00
Fariborz Jahanian 2e793d6124 ObjectiveC migrator. Place use of NS_NONATOMIC_IOSONLY
on inferred property attribute under
 -objcmt-ns-nonatomic-iosonly  option.
// rdar://15442742

llvm-svn: 194532
2013-11-13 00:08:36 +00:00
Fariborz Jahanian bed1be926d ObjectiveC migrator. Another alternative to
"atomic" or "nonatomic" for properties is
NS_NONATOMIC_IOSONLY. Use it if available.
// rdar://15442742

llvm-svn: 194503
2013-11-12 19:25:50 +00:00
Fariborz Jahanian 22626e7b49 ObjectiveC migrator. Added a dropped check in my
last patch.

llvm-svn: 194238
2013-11-08 02:00:22 +00:00
Fariborz Jahanian ec7cea925e ObjectiveC migrator. Fixes an obscure bug where
NS_RETURNS_INNER_POINTER ends up unintentionally 
on the @property under -objcmt-migrate-all 
// rdar://15396636

llvm-svn: 194233
2013-11-08 01:15:17 +00:00
Fariborz Jahanian 23417073ee ObjectiveC migrator. Please annotation of properties with
NS_RETURNS_INNER_POINTER under -objcmt-returns-innerpointer-property
flag (off by default), as older compilers do not support such annotations.
// rdar://15396636

llvm-svn: 194100
2013-11-05 22:28:30 +00:00
Fariborz Jahanian 071b98edec ObjectiveC migrator. When inferring readwrite property,
do not remove the setter if its availability differs
from availability of the getter (which is now turned into
a property). Otherwise, synthesized setter will
inherit availability of the property (which is incorrect).
// rdar://15300059

llvm-svn: 193837
2013-11-01 00:26:48 +00:00
Fariborz Jahanian d41dbadacd ObjectiveC migrator. Change naming hueristic for
deprecated categories, fixes a typo reported by
Jordan.

llvm-svn: 193759
2013-10-31 16:10:44 +00:00
Fariborz Jahanian 9d2ffea486 ObjectiveC migrator: annotate all protocols/methods in
a category with NSxxxDeprecated name with deprecated
annotation. // rdar://15337661

llvm-svn: 193726
2013-10-31 00:06:58 +00:00
Fariborz Jahanian 403425bba8 ObjectiveC migrator. Minor clean up of my last patch.
No functional change.

llvm-svn: 192933
2013-10-17 23:13:13 +00:00
Fariborz Jahanian de79e81686 ObjectiveC migrator. In infering NS_ENUM/NS_OPTIONS
macros, prefer the typedef immediately following the
enum declaration to the one preceeding it.
// rdar://15200915

llvm-svn: 192927
2013-10-17 22:23:32 +00:00
Fariborz Jahanian 1b6678767d ObjectiveC migrator. Remove blank lines
when inferring property from setter/getter
methods. // rdar://15200949

llvm-svn: 192853
2013-10-16 22:35:19 +00:00
Fariborz Jahanian 78bff0505e ObjectiveC migrator. Don't add 'assign' for
inferred properties when type is scalar and
assumed to be 'assign. // rdar://15231241

llvm-svn: 192841
2013-10-16 20:44:26 +00:00
Fariborz Jahanian 4a8865b145 ObjectiveC migrator. 'atomic' is the default attribute.
Don't add it to inferred property. // rdar://14988132

llvm-svn: 192834
2013-10-16 19:48:23 +00:00
Fariborz Jahanian 33304e3087 ObjectiveC migrator. Use 'assign' for 'delegate'
properties. // rdar://15231860

llvm-svn: 192826
2013-10-16 18:52:17 +00:00
Fariborz Jahanian 059e05eeef ObjectiveC migrator: Support for more possibility of
migration to NS_ENUM/NS_OPTIONS macros; when
typedef'ed to NSInteger/NSUInteger preceeds well
before of the enum declaration. // rdar://15201056

llvm-svn: 192645
2013-10-15 00:00:28 +00:00
Fariborz Jahanian 11dd4b1b56 ObjectiveC migrator. also support migration to
NS_ENUM/NS_OPTIONS macros when typedef declaration
precedes enum declaration. // rdar://15200915 

llvm-svn: 192506
2013-10-11 21:34:56 +00:00
Fariborz Jahanian 1d27ffd697 ObjectiveC migrator: fixes a bug when in NS_ENUM/NS_OPTIONS
migration, the typedef has annotations.
// rdar://15200602

llvm-svn: 192468
2013-10-11 17:35:22 +00:00
Fariborz Jahanian 9218f5178d ObjectiveC migrator. When migrating to NS_ENUM/NS_OPTIONS,
don't leave a blank line behind replacing the typedef
decl. // rdar://15200949

llvm-svn: 192407
2013-10-10 23:57:58 +00:00
Fariborz Jahanian 7c87b43d28 ObjectiveC migrator: For 'default' and 'shared' family of
methods, infer their self's type as their result type.
// rdar://15145218

llvm-svn: 192377
2013-10-10 18:23:13 +00:00
Fariborz Jahanian 20a1124ce5 ObjectiveC migrator. Introduce a new objcmt-atomic-property option
and use it to infer all properties as 'atomic'.
// rdar://14988132

llvm-svn: 192317
2013-10-09 19:06:08 +00:00
Fariborz Jahanian de557f84dd ObjectiveC migrator. Introduce a new print policy for
suppression of strong lifetime qualifiers when
inferring property. // rdar://15082812

llvm-svn: 192305
2013-10-09 17:37:28 +00:00
Fariborz Jahanian 3c593d63a1 ObjectiveC migrator: Add support for inferring
properties of function pointer type.
// rdar://15082812

llvm-svn: 192237
2013-10-08 21:32:16 +00:00
Fariborz Jahanian 02461d0218 ObjectiveC migration. Add support for inferring
properties of block pointer types. Also, remove
strong lifetime attribute from property type
in this migration. This is wip.
// rdar://15082818

llvm-svn: 192226
2013-10-08 20:14:24 +00:00
Fariborz Jahanian 8c45e283f2 ObjectiveC migrator: Add individual options and
enable them for distinct feature migration.
// rdar://15003157

llvm-svn: 191863
2013-10-02 22:49:59 +00:00
Fariborz Jahanian c121386170 ObjectiveC migrator. Starting distiguising different
migrations under their own option. 
wip and // rdar://15003157

llvm-svn: 191855
2013-10-02 21:32:39 +00:00
Fariborz Jahanian 182486c9d9 Objective-C migrator. Simplify migrator option
processing in preparation for adding several more
options. // rdar://15003157

llvm-svn: 191842
2013-10-02 17:08:12 +00:00
Fariborz Jahanian 8f5225b3a7 ObjectiveC migrator: When doing migration, migrator must suggest
migration of headers which have become system headers by user having put
the .system_framework in the sdk directory.
// rdar://15066802

llvm-svn: 191796
2013-10-01 21:16:29 +00:00
Fariborz Jahanian 5d783df5f7 ObjectiveC migrator. Infer property from getters only
if property name is a valid identifier in the underlying
language. // rdar://15044184

llvm-svn: 191584
2013-09-27 22:55:54 +00:00
Fariborz Jahanian 7c1a445c9e ObjectiveC migrator: Donlt annotate NS_RETURNS_INNER_POINTER
on class methods, as it makes no sense. // rdar://15069200

llvm-svn: 191468
2013-09-26 22:43:41 +00:00
Fariborz Jahanian 73466cafc1 ObjectiveC migrator: function pointer is not an
inner pointer for annotation to
objc_returns_inner_pointer purposes.
// rdar://15044991

llvm-svn: 191465
2013-09-26 21:43:47 +00:00
Fariborz Jahanian 7391a7b5aa ObjectiveC migrator. Don't suggest @property for
methods which look like getters but belong to
known family of methods. // rdar://15044058

llvm-svn: 191347
2013-09-25 00:17:07 +00:00
Fariborz Jahanian 7797c0d0f7 ObjectiveC migrator: provide space between the property
keyword and the rest on suggested property. // rdar://15069044

llvm-svn: 191335
2013-09-24 21:27:58 +00:00
Fariborz Jahanian 10b7435ceb ObjectiveC migrator: iDOn't mangle names when
NS_RETURNS_INNER_POINTER annotation is suggested on
a property. // rdar://15044991

llvm-svn: 191332
2013-09-24 20:20:52 +00:00
Fariborz Jahanian 1a73b8f7d2 Remove extra space.
llvm-svn: 191246
2013-09-23 23:48:04 +00:00
Fariborz Jahanian c71eb6adc3 ObjectiveC migrator. When migrating to property declaration
use Cocoa's naming convention for properties of ObjC
object type. // rdar://15045005

llvm-svn: 191240
2013-09-23 23:18:46 +00:00
Fariborz Jahanian 02bdb16524 ObjectiveC migrator: Infer NS_OPTIONS when if there is at
least one hex enumerator, all others are also
hex enumerator (0 enumerator is excepted). 
// rdar://15044304

llvm-svn: 191222
2013-09-23 20:27:06 +00:00
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
Argyrios Kyrtzidis 85230d50f2 [arcmt] Don't try to handle files that are already ARC'ified, this is not possible currently.
rdar://14461559

llvm-svn: 190880
2013-09-17 19:14:29 +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
Cameron Esfahani 556d91e2c3 Clean up some Triple usage in clang.
llvm-svn: 190737
2013-09-14 01:09:11 +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
Benjamin Kramer 5e5e5a92b4 ARCMigrate depends on the static analyzer.
llvm-svn: 188792
2013-08-20 12:33:59 +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
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 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
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 7122135fc3 ObjC migrator: more knobs toward doing
instancetype migration.

llvm-svn: 187000
2013-07-23 22:42:28 +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