Commit Graph

445 Commits

Author SHA1 Message Date
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
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
Argyrios Kyrtzidis 884bee86a6 [arcmt] Remove some dead code.
Patch by Rafael Espíndola.

llvm-svn: 186462
2013-07-16 22:24:06 +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
Rafael Espindola 16125fb652 Update for llvm API change.
llvm-svn: 186448
2013-07-16 19:44:23 +00:00
Fariborz Jahanian 5bd5affe2d ObjC migrator: build conforming interface
declaration (not yet used). wip.

llvm-svn: 186369
2013-07-16 00:20:21 +00:00
Fariborz Jahanian d36150d7ca ObjC migrator: finding conforming protocol
candidates for each class. wip.

llvm-svn: 186349
2013-07-15 21:22:08 +00:00
Fariborz Jahanian 9a3512b11d Fixes a typo caught by Arthur O'Dwyer
llvm-svn: 186249
2013-07-13 17:16:41 +00:00
Fariborz Jahanian 9eabf45fce ObjC migrator: More knobs for migrating
conforming protocols to each class. wip.

llvm-svn: 186231
2013-07-13 00:04:20 +00:00
Fariborz Jahanian 1be015300c ObjC migrator: early work for migrating implicitly conforming
protocols to classes. This is wip.

llvm-svn: 186220
2013-07-12 22:32:19 +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 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
Fariborz Jahanian 266926d85e [objc migrator]: More knobs to do migration to
use of objc's properties.

llvm-svn: 185724
2013-07-05 20:46:03 +00:00
Rafael Espindola a36e78ef5d Use llvm::sys::fs::createTemporaryFile.
llvm-svn: 185717
2013-07-05 20:00:06 +00:00
Fariborz Jahanian 43bbaaca80 [ObjectiveC migrator] relax the rules for setter/getter
types when deciding on validity of a property
inclusion. // rdar://14345082

llvm-svn: 185599
2013-07-04 00:24:32 +00:00
Fariborz Jahanian de66100889 Minor refactoring of my last patch.
llvm-svn: 185593
2013-07-03 23:44:11 +00:00
Fariborz Jahanian a7437f0227 [ObjectiveC Migration]: Provide knobs for
migrating setter/getter methods to an eventual
property declaraiton. This is wip.
// rdar://14345082

llvm-svn: 185591
2013-07-03 23:05:00 +00:00
Benjamin Kramer 33d4330393 Modernize some low-hanging PathV1 uses.
llvm-svn: 183903
2013-06-13 14:26:04 +00:00
Rafael Espindola be5138885d Include PathV1.h in files that use it.
This is preparation for replacing Path.h with PathV2.h.

llvm-svn: 183781
2013-06-11 19:59:07 +00:00
Rafael Espindola 3ae00052cd Cleanup handling of UniqueExternalLinkage.
This patch renames getLinkage to getLinkageInternal. Only code that
needs to handle UniqueExternalLinkage specially should call this.

Linkage, as defined in the c++ standard, is provided by
getFormalLinkage. It maps UniqueExternalLinkage to ExternalLinkage.

Most places in the compiler actually want isExternallyVisible, which
handles UniqueExternalLinkage as internal.

llvm-svn: 181677
2013-05-13 00:12:11 +00:00
Douglas Gregor 30071cead9 Remove DiagnosticConsumer::clone(), a bad idea that is now unused.
llvm-svn: 181070
2013-05-03 23:07:45 +00:00
Argyrios Kyrtzidis 37e48ff547 [Preprocessor] For the MacroExpands preprocessor callback, also pass the MacroArgs object that provides information about
the argument tokens for a function macro.

llvm-svn: 181065
2013-05-03 22:31:32 +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
NAKAMURA Takumi 2cc16a18cc ARCMigrate/Transforms.h: Remove \arg in comment. [-Wdocumentation]
llvm-svn: 179261
2013-04-11 04:16:11 +00:00
Argyrios Kyrtzidis d2c0abad2b [arcmt] Copy the diagnostics so we don't have to worry about invaliding iterators from the diagnostic list.
Should fix http://llvm.org/PR15500

llvm-svn: 178500
2013-04-01 21:12:30 +00:00
Rafael Espindola 45b620aab5 Add a hasExternalLinkage helper. No functionality change.
llvm-svn: 176607
2013-03-07 02:00:27 +00:00
Argyrios Kyrtzidis fead64be9b [preprocessor] Use MacroDirective in the preprocessor callbacks to make available the
full information about the macro (e.g if it was imported and where).

llvm-svn: 175978
2013-02-24 00:05:14 +00:00
David Blaikie 05785d1622 Include llvm::Optional in clang/Basic/LLVM.h
Post-commit CR feedback from Jordan Rose regarding r175594.

llvm-svn: 175679
2013-02-20 22:23:23 +00:00
David Blaikie 6adc78e0df Replace TypeLoc llvm::cast support to be well-defined.
The TypeLoc hierarchy used the llvm::cast machinery to perform undefined
behavior by casting pointers/references to TypeLoc objects to derived types
and then using the derived copy constructors (or even returning pointers to
derived types that actually point to the original TypeLoc object).

Some context is in this thread:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056804.html
Though it's spread over a few months which can be hard to read in the mail
archive.

llvm-svn: 175462
2013-02-18 22:06:02 +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
Chandler Carruth 4b41745e05 Re-sort all the headers. Lots of regressions have crept in here.
Manually fix the order of UnwrappedLineParser.cpp as that one didn't
have its associated header as the first header.

This also uncovered a subtle inclusion order dependency as CLog.h didn't
include LLVM.h to pick up using declarations it relied upon.

llvm-svn: 172892
2013-01-19 08:09:44 +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
Douglas Gregor 048fbfa302 Rework the traversal of Objective-C categories and extensions to
consider (sub)module visibility.

The bulk of this change replaces myriad hand-rolled loops over the
linked list of Objective-C categories/extensions attached to an
interface declaration with loops using one of the four new category
iterator kinds:

  visible_categories_iterator: Iterates over all visible categories
  and extensions, hiding any that have their "hidden" bit set. This is
  by far the most commonly used iterator.

  known_categories_iterator: Iterates over all categories and
  extensions, ignoring the "hidden" bit. This tends to be used for
  redeclaration-like traversals.

  visible_extensions_iterator: Iterates over all visible extensions,
  hiding any that have their "hidden" bit set.

  known_extensions_iterator: Iterates over all extensions, whether
  they are visible to normal name lookup or not.

The effect of this change is that any uses of the visible_ iterators
will respect module-import visibility. See the new tests for examples.

Note that the old accessors for categories and extensions are gone;
there are *Raw() forms for some of them, for those (few) areas of the
compiler that have to manipulate the linked list of categories
directly. This is generally discouraged.

Part two of <rdar://problem/10634711>.
 

llvm-svn: 172665
2013-01-16 23:00:23 +00:00
Dmitri Gribenko f857950d39 Remove useless 'llvm::' qualifier from names like StringRef and others that are
brought into 'clang' namespace by clang/Basic/LLVM.h

llvm-svn: 172323
2013-01-12 19:30:44 +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
Ted Kremenek 3d1464caee Update CMakeLists.txt
llvm-svn: 171505
2013-01-04 19:04:47 +00:00
Filipe Cabecinhas c18708ee6e Add file added in r171484 to CMakelists.txt.
llvm-svn: 171494
2013-01-04 18:52:29 +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
Argyrios Kyrtzidis 1f7321677c [arcmt] When capturing ARC errors, have a sanity check to make sure
the diagnostic has a valid location.

llvm-svn: 170040
2012-12-12 22:48:28 +00:00
Argyrios Kyrtzidis f5b993f7b1 [objc] For the ARC error that is emitted when a synthesized property implementation
has inconsistent ownership with the backing ivar, point the error location to the
ivar.

Pointing to the ivar (instead of the @synthesize) is better since this is where a fix is needed.
Also provide the location of @synthesize via a note.

This also fixes the problem where an auto-synthesized property would emit an error without
any location.

llvm-svn: 170039
2012-12-12 22:48:25 +00:00
Chandler Carruth 3a02247dc9 Sort all of Clang's files under 'lib', and fix up the broken headers
uncovered.

This required manually correcting all of the incorrect main-module
headers I could find, and running the new llvm/utils/sort_includes.py
script over the files.

I also manually added quite a few missing headers that were uncovered by
shuffling the order or moving headers up to be main-module-headers.

llvm-svn: 169237
2012-12-04 09:13:33 +00:00
Argyrios Kyrtzidis f3d587ea7c Refactor recording the preprocessor conditional directive regions out of
PreprocessingRecord and into its own class, PPConditionalDirectiveRecord.

Decoupling allows a client to use the functionality of PPConditionalDirectiveRecord
without needing a PreprocessingRecord.

llvm-svn: 169229
2012-12-04 07:27:05 +00:00
Benjamin Kramer d7d2b1fe45 Don't include Type.h in DeclarationName.h.
Recursively prune some includes.

llvm-svn: 169094
2012-12-01 16:35:25 +00:00
Benjamin Kramer ea70eb30a0 Pull the Attr iteration parts out of Attr.h, so including DeclBase.h doesn't pull in all the generated Attr code.
Required to pull some functions out of line, but this shouldn't have a perf impact.
No functionality change.

llvm-svn: 169092
2012-12-01 15:09:41 +00:00
Benjamin Kramer d81108f0bc s/tranform/transform/
llvm-svn: 167929
2012-11-14 15:08:31 +00:00
Bob Wilson 5ad5a9511c Remove old driver code to grab the iOS simulator version from the -D option.
We can now rely on the -mios-simulator-version-min command line option
and remove the awful hack. <rdar://problem/10304510>

llvm-svn: 167603
2012-11-09 01:59:30 +00:00
Douglas Gregor e81699d938 Move PreprocessorOptions into the Lex library, and make it intrusively
reference-counted.

llvm-svn: 166587
2012-10-24 17:01:35 +00:00
Douglas Gregor 7959178eb0 Use a .def file for most of the diagnostic options.
llvm-svn: 166520
2012-10-23 23:11:23 +00:00
Douglas Gregor 811db4eac4 Make DiagnosticOptions intrusively reference-counted, and make sure
the various stakeholders bump up the reference count. In particular,
the diagnostics engine now keeps the DiagnosticOptions object alive.

llvm-svn: 166508
2012-10-23 22:26:28 +00:00
Ted Kremenek cdf814900d Split library clangRewrite into clangRewriteCore and clangRewriteFrontend.
This is similar to how we divide up the StaticAnalyzer libraries to separate
core functionality to what is clearly associated with Frontend actions.

llvm-svn: 163050
2012-09-01 05:09:24 +00:00
Joao Matos 0e167f7368 Fixed invalid iterators. Since the iterator is invalidated after the erase() call, we need to replace it with the new one returned. This was triggering an assert under MSVC 2012 and making all the ARCMT/ tests fail.
llvm-svn: 163007
2012-08-31 17:28:09 +00:00
Richard Smith 802c4b7015 Fix undefined behavior: member function calls where 'this' is a null pointer.
llvm-svn: 162430
2012-08-23 06:16:52 +00:00
John McCall 3deb1ad40c Screw around with ObjCRuntime some more, changing the
diagnostics for bad deployment targets and adding a few
more predicates.  Includes a patch by Jonathan Schleifer
to enable ARC for ObjFW.

llvm-svn: 162252
2012-08-21 02:47:43 +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
NAKAMURA Takumi 836926dbdf clang/lib: [CMake] Update tblgen'd dependencies.
llvm-svn: 160851
2012-07-27 06:18:33 +00:00
NAKAMURA Takumi 075c89bc06 clang/lib: [CMake] Reformat, alphabetize lists.
llvm-svn: 160850
2012-07-27 06:18:12 +00:00
Sylvestre Ledru 830885ca64 Fix a typo (the the => the)
llvm-svn: 160622
2012-07-23 08:59:39 +00:00
Dmitri Gribenko ec92531c29 Implement AST classes for comments, a real parser for Doxygen comments and a
very simple semantic analysis that just builds the AST; minor changes for lexer
to pick up source locations I didn't think about before.

Comments AST is modelled along the ideas of HTML AST: block and inline content.

* Block content is a paragraph or a command that has a paragraph as an argument
  or verbatim command.
* Inline content is placed within some block.  Inline content includes plain
  text, inline commands and HTML as tag soup.

llvm-svn: 159790
2012-07-06 00:28:32 +00:00
Benjamin Kramer 4ab984e74b Drop the ASTContext.h include from DeclFriend.h and DeclTemplate.h.
llvm-svn: 159723
2012-07-04 20:19:54 +00:00
Benjamin Kramer 1ea8e092be Drop the ASTContext.h include from Stmt.h and fix up transitive users.
This required moving the ctors for IntegerLiteral and FloatingLiteral out of
line which shouldn't change anything as they are usually called through Create
methods that are already out of line.

ASTContext::Deallocate has been a nop for a long time, drop it from ASTVector
and make it independent from ASTContext.h

Pass the StorageAllocator directly to AccessedEntity so it doesn't need to
have a definition of ASTContext around.

llvm-svn: 159718
2012-07-04 17:04:04 +00:00
Chandler Carruth 28969b4139 Remove a goofy CMake hack and use the standard CMake facilities to
express library-level dependencies within Clang.

This is no more verbose really, and plays nicer with the rest of the
CMake facilities. It should also have no change in functionality.

llvm-svn: 158888
2012-06-21 01:30:21 +00:00
Argyrios Kyrtzidis aa38f695ad [arcmt]
-Disable -pedantic-errors when migrating per Jordan's suggestion.
-Use llvm_move() per John's suggestion.

llvm-svn: 158785
2012-06-20 01:46:26 +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
Dmitri Gribenko aab8383a2b Structured comment parsing, first step.
* Retain comments in the AST
* Serialize/deserialize comments
* Find comments attached to a certain Decl
* Expose raw comment text and SourceRange via libclang

llvm-svn: 158771
2012-06-20 00:34:58 +00:00
Jordan Rose 288c421b3d Insert a space if necessary when suggesting CFBridgingRetain/Release.
This was a problem for people who write 'return(result);'

Also fix ARCMT's corresponding code, though there's no test case for this
because implicit casts like this are rejected by the migrator for being
ambiguous, and explicit casts have no problem.

<rdar://problem/11577346>

llvm-svn: 158130
2012-06-07 01:10:31 +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
David Blaikie 40ed29730b Revert Decl's iterators back to pointer value_type rather than reference value_type
In addition, I've made the pointer and reference typedef 'void' rather than T*
just so they can't get misused. I would've omitted them entirely but
std::distance likes them to be there even if it doesn't use them.

This rolls back r155808 and r155869.

Review by Doug Gregor incorporating feedback from Chandler Carruth.

llvm-svn: 158104
2012-06-06 20:45:41 +00:00
Benjamin Kramer 972a96aede Remove the last dead private member in clang.
llvm-svn: 158100
2012-06-06 20:15:08 +00:00
Benjamin Kramer d1d76b2da7 Remove unused private member variables found by clang's new -Wunused-private-field.
llvm-svn: 158086
2012-06-06 17:32:50 +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 b482260748 [objcmt] Warn when modern objc migrator does not convert a NSNumber message because it requires a cast.
rdar://11525138

llvm-svn: 157395
2012-05-24 16:48:23 +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 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
David Blaikie dabed2229c Fix use of uninitialized variable caught by GCC's -Wmaybe-uninitialized.
Review by Doug Gregor.

llvm-svn: 155880
2012-05-01 02:45:39 +00:00
David Blaikie b15de1eaed Remove ref/value inconsistency in redecl_iterator.
Similar to r155808 - this mistake has been made in a few iterators.

Based on Chandler Carruth's feedback to r155808 I added an implicit conversion
to Decl* to ease adoption/usage. Useful for the pointer comparison, but not the
dyn_cast (due to template argument deduction causing the conversion not to be
used) - there for future convenience, though. This idiom (op T* for iterators)
seems to be fairly idiomatic within the LLVM codebase & I'll likely add it as I
fix up the other iterators here.

llvm-svn: 155869
2012-05-01 00:48:43 +00:00
David Blaikie 2d7c57ec1d Remove the ref/value inconsistency in filter_decl_iterator.
filter_decl_iterator had a weird mismatch where both op* and op-> returned T*
making it difficult to generalize this filtering behavior into a reusable
library of any kind.

This change errs on the side of value, making op-> return T* and op* return
T&.

(reviewed by Richard Smith)

llvm-svn: 155808
2012-04-30 02:36:29 +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
Benjamin Kramer e894e09e70 Simplify some users of DenseMap::erase.
llvm-svn: 153389
2012-03-24 18:22:12 +00:00
Jordy Rose 9046bcd03b Kill cocoa::deriveNamingConvention and cocoa::followsFundamentalRule. They are now just simple wrappers around method families, and method decls can cache method family lookups. Also, no one is using them right now.
The one difference between ObjCMethodDecl::getMethodFamily and Selector::getMethodFamily is that the former will do some additional sanity checking, and since CoreFoundation types don't look like Objective-C objects, an otherwise interesting method will get a method family of OMF_None. Future clients that use method families should consider how they want to handle CF types.

llvm-svn: 153000
2012-03-17 20:51:32 +00:00
Argyrios Kyrtzidis ecbe8b4fab [arcmt] The hard-coded list of weak-incompatible classes is no longer necessary.
rdar://10673816

llvm-svn: 152879
2012-03-16 00:21:22 +00:00
Argyrios Kyrtzidis 99282b783e [arcmt] iOS is always safe to use 'weak'. rdar://10950825
llvm-svn: 152878
2012-03-16 00:10:35 +00:00
David Blaikie bbafb8a745 Unify naming of LangOptions variable/get function across the Clang stack (Lex to AST).
The member variable is always "LangOpts" and the member function is always "getLangOpts".

Reviewed by Chris Lattner

llvm-svn: 152536
2012-03-11 07:00:24 +00:00
John McCall 113bee0536 Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr to
track whether the referenced declaration comes from an enclosing
local context.  I'm amenable to suggestions about the exact meaning
of this bit.

llvm-svn: 152491
2012-03-10 09:33:50 +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 981a961d03 Move llvm/ADT/SaveAndRestore.h -> llvm/Support/SaveAndRestore.h.
Needs llvm update.

llvm-svn: 151829
2012-03-01 19:45:56 +00:00
Argyrios Kyrtzidis bb5abc7b49 Move "clang/Analysis/Support/SaveAndRestore.h" to "llvm/ADT/SaveAndRestore.h"
to make it more widely available.

Depends on llvm commit r151564

llvm-svn: 151566
2012-02-27 21:09:45 +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
Dylan Noblesmith c95d81924d Basic: import IntrusiveRefCntPtr<> into clang namespace
The class name is long enough without the llvm:: added.
Also bring in RefCountedBase and RefCountedBaseVPTR.

llvm-svn: 150958
2012-02-20 14:00:23 +00:00
Dylan Noblesmith 2c1dd2716a Basic: import SmallString<> into clang namespace
(I was going to fix the TODO about DenseMap too, but
that would break self-host right now. See PR11922.)

llvm-svn: 149799
2012-02-05 02:13:05 +00:00
Dylan Noblesmith e27789991d Basic: import OwningPtr<> into clang namespace
llvm-svn: 149798
2012-02-05 02:12:40 +00:00
Benjamin Kramer 4903802fbf Move a method from IdentifierTable.h out of line and remove the SmallString include.
Fix all the transitive include users.

llvm-svn: 149783
2012-02-04 13:45:25 +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 0c859d67ef arc migrator: Added an option to the migrator
unused yet.

llvm-svn: 149001
2012-01-26 00:08:04 +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
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
Douglas Gregor 32fbe31246 Extract the (InputKind, std::string) pair used to describe inputs to
the front end into its own class, FrontendInputFile, to make it easier
to introduce new per-input data. No functionality change.

llvm-svn: 148546
2012-01-20 16:28:04 +00:00
Argyrios Kyrtzidis 1b07c344b4 For Lexer's isAt[Start/End]OfMacroExpansion add an out parameter for the macro
start/end location.

It is commonly needed after calling the function; with this way we avoid
recalculating it.

llvm-svn: 148479
2012-01-19 15:59:08 +00:00
Rafael Espindola 65e025cad5 Remove unused variables.
llvm-svn: 147260
2011-12-25 01:18:52 +00:00
Douglas Gregor dc9166c8e1 Keep track of all declarations of an Objective-C class (both forward
declarations and definitions) as ObjCInterfaceDecls within the same
redeclaration chain. This new representation matches what we do for
C/C++ variables/functions/classes/templates/etc., and makes it
possible to answer the query "where are all of the declarations of
this class?"

llvm-svn: 146679
2011-12-15 20:29:51 +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
Ted Kremenek 2acedbd417 Refine placement of LangOptions object in CompilerInvocation by adding a new baseclass CompilerInvocationBase with a custom copy constructor. This ensures that whenever the CompilerInvocation object's copy constructor is used we always clone the LangOptions object.
llvm-svn: 144973
2011-11-18 04:32:13 +00:00
Ted Kremenek 8cf47df72f Make 'LangOptions' in CompilerInvocation a heap-allocated, reference counted object. I discovered that llvm::RefCountedBase<T> has
a bug where the reference count is copied in the copy constructor, which means that there were cases when the CompilerInvocation
objects created by ASTUnit were actually leaked.  When I fixed that bug locally, it showed that a whole bunch of code assumed
that the LangOptions object that was part of CompilerInvocation was still alive.  By making it heap-allocated and reference counted,
we can keep it around after the CompilerInvocation object goes away.

As part of this change, change CompilerInvocation:getLangOptions() to return a pointer, acting as another clue that this
object may outlive the CompilerInvocation object.

This commit doesn't fix the CompilerInvocation leak itself.  That will come when I commit the fix to llvm::RefCountedBase<T> to
mainline LLVM.

llvm-svn: 144930
2011-11-17 23:01:24 +00:00