Commit Graph

1360 Commits

Author SHA1 Message Date
Fariborz Jahanian d45e7cec42 Objective-C arc. Switch the Objective-C dictionary literal in ARC mode
to use non-retain/autorelease API variants of ObjC objects. wip.
rdar://17554063

llvm-svn: 215146
2014-08-07 20:57:35 +00:00
Fariborz Jahanian 2a25dba153 Objective-C ARC. More code for Objective-C's
new APIs for literals. nfc. wip. rdar://17554063

llvm-svn: 215043
2014-08-06 23:40:31 +00:00
Fariborz Jahanian 261aa1f23a Objective-C. Improve diagnostic when property is
not auto synthesized in current implementation.
rdar://17774815

llvm-svn: 214090
2014-07-28 16:35:45 +00:00
Fariborz Jahanian 6c9ee7b0c8 Objective-C. Issue more warning diagnostic when certain
properties are not synthesized in property auto-synthesis,
as it can potentiall lead to runtime errors.
rdar://17774815

llvm-svn: 214032
2014-07-26 20:52:26 +00:00
Fariborz Jahanian a57d91c2ae Objective-C. Warn if protocol used in an @protocol
expression is a forward declaration as this results
in undefined behavior. rdar://17768630

llvm-svn: 213968
2014-07-25 19:45:01 +00:00
Fariborz Jahanian ac6b4efaab Objective-C. Patch to warn if the result of calling a property getter
is unused (this is match behavior when property-dot syntax is used to
use same getter). rdar://17514245
Patch by Anders Carlsson with minor refactoring by me.

llvm-svn: 213423
2014-07-18 22:59:10 +00:00
Fariborz Jahanian b93355e9b1 Objective-C. deprecated attribute is not inherited on methods
overriden in interfaces and protocols (this is already the case
for properties). rdar://16068470

llvm-svn: 213282
2014-07-17 17:05:04 +00:00
Fariborz Jahanian a2e5deb86d Objective-C. Changes per A. Ballman's comment
for my last patch. // rdar://17631257

llvm-svn: 213185
2014-07-16 19:44:34 +00:00
Alp Toker a3c494f0db Revert "clang/test/Driver/crash-report.c: This requires rewriter for -frewrite-includes. [PR20321]"
We've decided to make the core rewriter class and PP rewriters mandatory.
They're only a few hundred lines of code in total and not worth supporting as a
distinct build configuration, especially since doing so disables key compiler
features.

This reverts commit r213150.

Revert "clang/test: Introduce the feature "rewriter" for --enable-clang-rewriter."

This reverts commit r213148.

Revert "Move clang/test/Frontend/rewrite-*.c to clang/test/Frontend/Rewriter/"

This reverts commit r213146.

llvm-svn: 213159
2014-07-16 15:12:48 +00:00
NAKAMURA Takumi 692d6bb544 clang/test: Introduce the feature "rewriter" for --enable-clang-rewriter.
llvm-svn: 213148
2014-07-16 13:36:39 +00:00
Kaelyn Takata 22101f9689 Continue parsing an expression list even after an error is encountered.
Otherwise, multiple errors such as having unknown identifiers for two
arguments won't be diagnosed properly (e.g. only the first one would
have a diagnostic message if typo correction fails even though both
would be diagnosed if typo correction suggests a replacement).

llvm-svn: 213003
2014-07-14 22:48:10 +00:00
Alp Toker 5d96e0a3a7 Consolidate header inclusion diagnostics
Make argument orders match, unify diagnostic IDs and reword the message to be a
little less saccharine.

llvm-svn: 212845
2014-07-11 20:53:51 +00:00
Fariborz Jahanian dacffc0d8d Objective-C. When we use @selector(save:), etc. there may be more
than one method with mismatched type of same selector name. 
clang issues a warning to point this out since it may cause 
undefined behavior. There are cases though that some APIs 
don't care about user methods and such warnings are perceived as 
noise. This patch allows users to add paren delimiters around
selector name to turn off such warnings. So, @selector((save:)) will
turn off the warning. It also provides 'fixit' so user knows 
what to do. // rdar://16458579

llvm-svn: 211611
2014-06-24 17:02:19 +00:00
Fariborz Jahanian d329674028 Objective-C qoi. When Objective-C pointer mismatches with
a qualified-id type because pointer is object of a forward
class declaration, include this info in a diagnostic note.
// rdar://10751015

llvm-svn: 211324
2014-06-19 23:05:46 +00:00
Fariborz Jahanian c03ef578eb Objective-C ARC. Allow conversion of (void*) pointers to
retainable ObjC pointers without requiring a bridge-cast
in the context of pointer comparison as this is in effect 
a +0 context. // rdar://16627903

llvm-svn: 211243
2014-06-18 23:52:49 +00:00
Fariborz Jahanian 1ad83a35b1 Objective-C. Revert my patch in r211234.
llvm-svn: 211237
2014-06-18 23:22:38 +00:00
Fariborz Jahanian 62aeb8b653 Objective-C ARC. Allow conversion of (void*) pointers to
retainable ObjC pointers without requiring a bridge-cast
by recognizing this as a +0 context. // rdar://16627903

llvm-svn: 211234
2014-06-18 22:50:40 +00:00
Fariborz Jahanian 5d64abba0a Objective-C. Check for integer overflow in Objective-C's
boxed expression. // rdar://16417427

llvm-svn: 211215
2014-06-18 20:49:02 +00:00
Fariborz Jahanian caaa5f55b6 Objective-C. Try to fix the test in buildbot in my last patch.
llvm-svn: 211197
2014-06-18 18:16:37 +00:00
Fariborz Jahanian 285b6b6585 Objective-C. Attributes on class declarations carry over
to forward class declarations for diagnosis. 
// rdar://16681279

llvm-svn: 211195
2014-06-18 17:58:27 +00:00
Fariborz Jahanian 9277ff426d Objective-C ARC. Do not warn about properties with both
IBOutlet and weak attributes when accessed being
unpredictably set to nil because usage of such properties
are always single threaded and its ivar cannot be set
to nil asynchronously. // rdar://15885642 

llvm-svn: 211132
2014-06-17 23:35:13 +00:00
Fariborz Jahanian 89ea9610b3 Objective-C. Diagnose when property access is using declared
property accessor methods which have become deprecated
or available. // rdar://15951801

llvm-svn: 211039
2014-06-16 17:25:41 +00:00
Fariborz Jahanian 8df9e2438b Objective-C ARC. Blocks that strongly capture themselves
to call themselves will get the warning:
"Capturing <itself> strongly in this block is likely to
lead to a retain cycle". Cut down on the amount of noise
by noticing that user at some point sets the captured variable
to null in order to release it (and break the cycle). 
// rdar://16944538

llvm-svn: 210823
2014-06-12 20:57:14 +00:00
Fariborz Jahanian 8456406cdf More tests for // rdar://17259812
llvm-svn: 210798
2014-06-12 16:55:43 +00:00
Fariborz Jahanian 9c10032c79 Objective-C. Accept '__attribute__((__ns_returns_retained__))'
for function/methods returning block in MRR mode as well.
// rdar://17259812

llvm-svn: 210706
2014-06-11 21:22:53 +00:00
Fariborz Jahanian 9af6a78f36 Objective-C. More tests for both bridging attributes and
a fix to make it work when CFStructs have no definition.
// rdar://17238954.

llvm-svn: 210690
2014-06-11 19:10:46 +00:00
Fariborz Jahanian 5cbbb1be92 Objective-C. Patch to handle bridge attribute warnings
correctly when both NSAttributedString and
NSMutableAttributedString are specified on the same
CFStruct via different typedefs. // rdar://17238954

llvm-svn: 210660
2014-06-11 16:52:44 +00:00
Fariborz Jahanian 3d5764091d Objective-C. Don't ignore availability attribute when
doing Objective-C subscript access. // rdar://16842487
PR19682.

llvm-svn: 210565
2014-06-10 19:02:48 +00:00
Fariborz Jahanian 7ea91b2892 Objective-C. Consider block pointer as NSObject as well as conforming to
'NSCopying' protocol when diagnosing block to ObjC pointer conversion.
// rdar://16739120

llvm-svn: 210491
2014-06-09 21:42:01 +00:00
Fariborz Jahanian b3a7068700 Objective-C. Diagnose assigning a block pointer type to
an Objective-C object type other than 'id'. 
// rdar://16739120

llvm-svn: 209906
2014-05-30 16:35:53 +00:00
Fariborz Jahanian 555132824a Objective-C. Diagnose use of properties in functions nested in,
now deprecated, ObjC containers instead of crashing. 
// rdar://16859666

llvm-svn: 209758
2014-05-28 18:12:10 +00:00
Fariborz Jahanian 3451df8f5d Objective-C. Deprecate use of function definitions
in Objective-C container declarations (but not
in their definitions. // rdar://10414277

llvm-svn: 209751
2014-05-28 17:02:35 +00:00
Fariborz Jahanian 0c1c3113e8 Objective-C. Fixes an obscuer crash caused by multiple inclusion of
same framework after complaining about duplicate class definition.
// rdar://17024681

llvm-svn: 209672
2014-05-27 18:26:09 +00:00
Fariborz Jahanian 65a78b5d9b Objective-C. Reduce false positive warnings with -Wselector by issuing warning
only when named selector is declared in TU and it is not declared in a system
header. rdar://16600230

llvm-svn: 208443
2014-05-09 19:51:39 +00:00
Benjamin Kramer a7bcab75d2 ThreadSafetyAnalysis: Don't crash when trying to analyze objc methods.
The thread safety analysis isn't very useful in ObjC (you can't annotate
ObjC classes or methods) but we can still analyze the actual code and
show violations in usage of C/C++ functions.

Fixes PR19541, which does not use thread safety attributes but crashes
with -Weverything.

llvm-svn: 208436
2014-05-09 17:08:01 +00:00
Argyrios Kyrtzidis 37b7b2aefc Rename "secondary initializer" -> "convenience initializer" in the warnings, which is a more correct and consistent term.
llvm-svn: 208142
2014-05-06 23:24:16 +00:00
Fariborz Jahanian f1a22f487e Objective-C. Improve diagnosis of bridging types.
// rdar://16737117

llvm-svn: 207542
2014-04-29 16:12:56 +00:00
Argyrios Kyrtzidis 357b36a2c0 [SemaObjC] Fix ObjCInterfaceDecl::inheritsDesignatedInitializers(), if there are no
designated initializers in the super class hierarchy then it should return false.

rdar://16692535

llvm-svn: 207332
2014-04-26 21:28:41 +00:00
Fariborz Jahanian 9da2a799ab Objective-C [IRGen]. Fixes a crash in IRGen involving use of
'typeof' to extract type of an @encode expression used
in an initializer. // rdar://16655340

llvm-svn: 207004
2014-04-23 17:44:58 +00:00
Fariborz Jahanian 953d18a988 Objective-C ARC. Under ARC, addition of 'bridge' attribute
on CF type is not sufficient and bridge casting is
still required for proper ownership semantics.
// rdar://16650445

llvm-svn: 206910
2014-04-22 17:42:01 +00:00
Fariborz Jahanian 29cdbc6319 Objective-C. Patch to allow use of dot syntax on class
objects to fund root class's instance methods.
// rdar://16650575

llvm-svn: 206781
2014-04-21 20:22:17 +00:00
Alp Toker 8ee5b01f34 Move ObjC Cocoa.h header test to Headers
This tests for broad compatibility with platform SDK headers using the clang
driver and so belongs alongside the other header ingtegration tests.

llvm-svn: 206687
2014-04-19 19:07:24 +00:00
Argyrios Kyrtzidis de10366c06 [objc] -[NSObject init] is documented to not do anything, don't warn if subclasses do not call [super init] on their initializers.
Part of rdar://16568441

llvm-svn: 206410
2014-04-16 18:32:51 +00:00
Argyrios Kyrtzidis 441f626bd9 [objc] Consider new initializers inside @implementation when determining if the class
introduces new initializers.

Part of rdar://16568441

llvm-svn: 206409
2014-04-16 18:32:42 +00:00
Fariborz Jahanian 48a01cb5ec Objective-C arc [Sema]. Allow bridge cast of a qualified-id expression
when bridged Objective-C type conforms to the protocols in CF types's
Objective-C class. // rdar://16393330

llvm-svn: 205659
2014-04-04 23:53:45 +00:00
Paul Robinson f067435026 Implement the 'optnone' attribute, which suppresses most optimizations
on a function.

llvm-svn: 205255
2014-03-31 22:29:15 +00:00
Tim Northover a2ee433c8d ARM64: initial clang support commit.
This adds Clang support for the ARM64 backend. There are definitely
still some rough edges, so please bring up any issues you see with
this patch.

As with the LLVM commit though, we think it'll be more useful for
merging with AArch64 from within the tree.

llvm-svn: 205100
2014-03-29 15:09:45 +00:00
Ted Kremenek ab57a1555a [-Wunreachable-code] Expand paren-suppression heuristic to C++/ObjC bools.
llvm-svn: 205074
2014-03-29 04:49:20 +00:00
Fariborz Jahanian 6e94302ee3 Objective-C. Make -Wselector-type-mismatch off by
default until we provide a work-around for warning
suppression.

llvm-svn: 205066
2014-03-28 23:23:12 +00:00
Argyrios Kyrtzidis 6af9bc565e [SemaObjC] For the semantics of the designated-initializer attribute, consider that the ObjC interface of the class
includes its class extensions.

This is follow-up for rdar://16305347

llvm-svn: 205065
2014-03-28 22:45:38 +00:00