Commit Graph

474 Commits

Author SHA1 Message Date
Fariborz Jahanian effffaae3b Objective-C. Allow [super initialize] in an +initialize
implementation but not anywhere else.
rdar://16628028


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216408 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-25 21:27:38 +00:00
Fariborz Jahanian 024d9c65e9 Objective-C. Warn when @encode'ing provides an incomplete
type encoding because in certain cases, such as for vector
types, because we still haven't designed encoding for them.
rdar://9255564


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216301 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-22 23:17:52 +00:00
Fariborz Jahanian 7d38fcd81f Objective-C. Update my previous patch to not warn if
+initialize is called on 'super' in its implementation.
rdar://16628028


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216282 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-22 19:52:49 +00:00
Fariborz Jahanian 99ef95c3fc Objective-C. Warn if user has made explicit call
to +initilize as this results in an extra call
to this method. rdar://16628028


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216271 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-22 16:57:26 +00:00
Fariborz Jahanian b9f1d9e841 Objective-C [qoi]. Provide fix-it hint when sending
class method to an object receiver. rdar://16263395



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216038 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-19 23:39:17 +00:00
Fariborz Jahanian 34db924fa7 Objective-C. Do not warn if user is using property-dox syntax to name a
user provided setter name (as declared in @property attribute declaration).
rdar://18022762


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215736 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-15 17:39:00 +00:00
Fariborz Jahanian cd21fe6e8a Objective-C. Handle case of multiple class methods
found in global pool as well. rdar://16808765


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215603 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-13 23:38:04 +00:00
Fariborz Jahanian dc812ef2ed Objective-C. Minor refactoring of my last patch.
// rdar://16808765


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215581 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-13 21:24:14 +00:00
Fariborz Jahanian 7cdaec7226 Objective-C. This patch is to resolve the method used in method
expression to the best method found in global method pools. 
This is wip.  // rdar://16808765


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215577 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-13 21:07:35 +00:00
Fariborz Jahanian 7c33b6163c Objective-C [qoi]. Patch to not do Fix-It for fixing
a messaging expression except in the simple case
of a unary selector. We cannot reliably provide such a fixit due
to numerous reasons where a matching selector could not be found.
rdar://15756038


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215480 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-12 22:16:41 +00:00
Fariborz Jahanian 6149524f3a Objective-C [qoi]. Issue warning and fixit if property-dot syntax
use mis-cased property name (which is currently accepted silently
due to the way property setters are named). rdar://17911746


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215250 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-08 22:33:24 +00:00
Fariborz Jahanian 25fa83175c Objective-C. Minor refactoring of my previous patch.
rdar://17554063


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215235 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-08 18:29:52 +00:00
Fariborz Jahanian 422dd7b9f7 Objective-C ARC. Use of non-retain/autorelease API
for building Objective-C array literals in ARC
mode. rdar://17554063


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215232 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-08 17:31:14 +00:00
Fariborz Jahanian 62e6156242 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215146 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-07 20:57:35 +00:00
Fariborz Jahanian cce419586f Objective-C ARC. More code for Objective-C's
new APIs for literals. nfc. wip. rdar://17554063


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215043 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-06 23:40:31 +00:00
Fariborz Jahanian 8d3e43c6b1 Objective-C ARC. First patch toward generating new APIs
for Objective-C's array and dictionary literals.
rdar://17554063. This is wip.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214983 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-06 18:13:46 +00:00
Aaron Ballman 306de08679 Replacing some more complex logic with a helper function call to ObjCMethod::getReturnTypeSourceRange. No functional changes intended.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214511 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-01 13:20:09 +00:00
Fariborz Jahanian dd5b95a80e Obective-C. Patch to fix the incorrect ObjcMessageExpr argument source ranges,
when arguments are structures or classes. PR16392.
patch by Karlis Senko


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214409 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-31 17:39:50 +00:00
Fariborz Jahanian 11b178d35a Objective-C. Warn if protocol used in an @protocol
expression is a forward declaration as this results
in undefined behavior. rdar://17768630


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213968 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-25 19:45:01 +00:00
Alp Toker e9a2e9d4e3 Switch over a few uses of param_begin() to parameters()
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212442 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-07 09:02:20 +00:00
Fariborz Jahanian 1b9b13db0c Objective-C ARC. Provide diagnostic and fix-it
when casting a retainable object to a objc_bridge_related
CF type with the suggestion of applying the method
specified in the bridging attribute to the object.
// rdar://15932435


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211807 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-26 21:22:16 +00:00
Fariborz Jahanian a36053be37 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211611 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-24 17:02:19 +00:00
Fariborz Jahanian 88a39adcf6 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211243 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-18 23:52:49 +00:00
Fariborz Jahanian e15ff8e771 Objective-C. Revert my patch in r211234.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211237 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-18 23:22:38 +00:00
Fariborz Jahanian 8e5db87d61 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211234 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-18 22:50:40 +00:00
Fariborz Jahanian 82a8be9ffd Objective-C. Check for integer overflow in Objective-C's
boxed expression. // rdar://16417427


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211215 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-18 20:49:02 +00:00
Fariborz Jahanian 96c7d0173a 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 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211132 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-17 23:35:13 +00:00
Alp Toker 7225802bf9 Hide the concept of diagnostic levels from lex, parse and sema
The compilation pipeline doesn't actually need to know about the high-level
concept of diagnostic mappings, and hiding the final computed level presents
several simplifications and other potential benefits.

The only exceptions are opportunistic checks to see whether expensive code
paths can be avoided for diagnostics that are guaranteed to be ignored at a
certain SourceLocation.

This commit formalizes that invariant by introducing and using
DiagnosticsEngine::isIgnored() in place of individual level checks throughout
lex, parse and sema.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211005 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-15 23:30:39 +00:00
Fariborz Jahanian 1e56828b1a Objective-C. More tests for both bridging attributes and
a fix to make it work when CFStructs have no definition.
// rdar://17238954.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210690 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-11 19:10:46 +00:00
Fariborz Jahanian ceaaaef14c 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210660 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-11 16:52:44 +00:00
Nikola Smiljanic f6cf7c7789 Refactoring. Remove Owned method from Sema.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209812 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-29 14:05:12 +00:00
Nikola Smiljanic be481708fb Refactoring. Remove release and take methods from ActionResult. Rename takeAs to getAs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209800 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-29 10:55:11 +00:00
Craig Topper 6b8c5857eb [C++11] Use 'nullptr'. Sema edition.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209613 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-26 06:22:03 +00:00
Fariborz Jahanian 5225cc82e1 Objective-C ARC. Add support for toll-free bridge
type ,and bridge attribute, checking with static_cast. 
// rdar://16756639


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208474 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-10 17:40:11 +00:00
Fariborz Jahanian 53331ec34a 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208443 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-09 19:51:39 +00:00
Fariborz Jahanian 56844d5f63 Objective-C. Improve diagnosis of bridging types.
// rdar://16737117


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207542 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-29 16:12:56 +00:00
John Thompson 9be87f8785 Initial implementation of -modules-earch-all option, for searching for symbols in non-imported modules.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206977 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-23 12:57:01 +00:00
Fariborz Jahanian 4ab423cd70 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206910 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-22 17:42:01 +00:00
Fariborz Jahanian 46ddd12e6b Objective-C. Patch to allow use of dot syntax on class
objects to fund root class's instance methods.
// rdar://16650575


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206781 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-21 20:22:17 +00:00
Fariborz Jahanian 297e5869c5 Objective-C. Make multiple selector warning
an opt-in option under -Wselector-type-mismatch.
// rdar://16445728


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204965 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-27 21:59:01 +00:00
Fariborz Jahanian 7513eb534a Objective-C. Consider blocks for designated initializer
warnings (warning or lack there of) as well since
blocks are another pattern for envoking other
designated initializers. // rdar://16323233


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204081 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-17 21:41:40 +00:00
Aaron Ballman 4f8e7df26b [C++11] Replacing ObjCObjectPointerType iterators qual_begin() and qual_end() with iterator_range quals(). Updating all of the usages of the iterators with range-based for loops.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204048 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-17 16:14:00 +00:00
Aaron Ballman 314ff89bfe [C++11] Replacing ObjCObjectType iterators qual_begin() and qual_end() with iterator_range quals(). Updating all of the usages of the iterators with range-based for loops.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204047 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-17 15:55:30 +00:00
Fariborz Jahanian 258ede62c0 Objective-C. Issue diagnostics on mismatched methods when their selector is used
in an @selector expression. // rdar://15794055


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203693 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-12 18:34:01 +00:00
Craig Topper 34e9e13d3a [C++11] Add 'override' keyword to virtual methods that override their base class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203640 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-12 04:55:44 +00:00
Benjamin Kramer 225d9cf75f Sema: When merging objc string literals, give the result a constant array type.
Also assert that we never create non-array string literals again.

PR18939.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202147 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-25 12:26:20 +00:00
Alp Toker 37545f747c 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200082 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-25 16:55:45 +00:00
Argyrios Kyrtzidis ee82f63db3 [objc] Refactor and improve functionality for the -Wunused-property-ivar warning.
- Remove the additions to ObjCMethodDecl & ObjCIVarDecl that were getting de/serialized and consolidate
  all functionality for the checking for this warning in Sema::DiagnoseUnusedBackingIvarInAccessor
- Don't check immediately after the method body is finished, check when the @implementation is finished.
  This is so we can see if the ivar was referenced by any other method, even if the method was defined after the accessor.
- Don't silence the warning if any method is called from the accessor silence it if the accessor delegates to another method via self.

rdar://15727325

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198432 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-03 18:32:18 +00:00
Aaron Ballman aa81229216 Removing some more unnecessary manual quotes from attribute diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198391 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-03 02:07:43 +00:00
Fariborz Jahanian c0861a05e6 ObjectiveC. Remove false positive warning for missing property
backing ivar by not issuing this warning if ivar is referenced
somewhere and accessor makes method calls. // rdar://15727325


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198367 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-02 22:42:09 +00:00