summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [C++11] Replacing ObjCInterfaceDecl iterators known_categories_begin() and ↵Aaron Ballman2014-03-131-6/+2
| | | | | | known_categories_end() with iterator_range known_categories(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203854
* [C++11] Replacing ObjCInterfaceDecl iterators visible_categories_begin() and ↵Aaron Ballman2014-03-131-5/+2
| | | | | | visible_categories_end() with iterator_range visible_categories(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203851
* [C++11] Replacing ObjCInterfaceDecl iterators ivar_begin() and ivar_end() ↵Aaron Ballman2014-03-131-3/+1
| | | | | | with iterator_range ivars(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203849
* [C++11] Replacing ObjCInterfaceDecl iterators ↵Aaron Ballman2014-03-131-17/+8
| | | | | | all_referenced_protocol_begin() and all_referenced_protocol_end() with iterator_range all_referenced_protocols(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203848
* [C++11] Replacing ObjCContainerDecl iterators classmeth_begin() and ↵Aaron Ballman2014-03-131-23/+13
| | | | | | classmeth_end() with iterator_range class_methods(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203840
* [C++11] Replacing ObjCContainerDecl iterators instmeth_begin() and ↵Aaron Ballman2014-03-131-27/+16
| | | | | | instmeth_end() with iterator_range instance_methods(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203839
* Renaming the recently-created (r203830) props() range API to properties() ↵Aaron Ballman2014-03-131-2/+2
| | | | | | for clarity. llvm-svn: 203835
* [C++11] Replacing ObjCContainerDecl iterators meth_begin() and meth_end() ↵Aaron Ballman2014-03-131-7/+2
| | | | | | with iterator_range methods(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203832
* [C++11] Replacing ObjCContainerDecl iterators prop_begin() and prop_end() ↵Aaron Ballman2014-03-131-7/+3
| | | | | | with iterator_range props(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203830
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-121-1/+1
| | | | | | class. llvm-svn: 203640
* Objective-C. Diagose use of undefined protocolsFariborz Jahanian2014-03-111-1/+22
| | | | | | | when a class adopts a protocol that inherits from undefined protocols. // rdar://16111182 llvm-svn: 203586
* [C++11] Remove the remaining uses of OwningPtr.Ahmed Charles2014-03-091-4/+2
| | | | | | Replace OwningArrayPtr with std::unique_ptr<T[]>. llvm-svn: 203388
* [C++11] Replacing ObjCMethodDecl iterators param_begin() and param_end() ↵Aaron Ballman2014-03-071-5/+3
| | | | | | with iterator_range params(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203255
* Fix recursion bug in logic to validate ↵Ted Kremenek2014-03-051-3/+14
| | | | | | 'objc_protocol_requires_explicit_implementation' conformance. llvm-svn: 203024
* Adjust logic for 'objc_protocol_requires_explicit_implementation' for ↵Ted Kremenek2014-03-051-6/+54
| | | | | | | | | | | | | | | | | | | | | | | | inherited protocols and protocols already conformed in the class hierarchy. Per more discussion, 'objc_protocol_requires_explicit_implementation' is refinement that it mainly adds that requirement that a protocol must be explicitly satisfied at the moment the first class in the class hierarchy conforms to it. Any subclasses that also conform to that protocol, either directly or via conforming to a protocol that inherits that protocol, do not need to re-implement that protocol. Doing this requires first doing a pass on the super class hierarchy, gathering the set of protocols conformed to by the super classes, and then culling those out when determining conformance. This two-pass algorithm could be generalized for all protocol checking, and could possibly be a performance win in some cases. For now we restrict this change to protocols with this attribute to isolate the change in logic (especially as the design continues to evolve). This change needs to be adjusted for properties as well; this only impacts methods right now. llvm-svn: 202948
* [ObjC] Change default property synthesis logic to not completely skip ↵Ted Kremenek2014-02-211-7/+9
| | | | | | | | | DiagnoseUnimplementedProperties. We're going to extend DiagnoseUnimplementedProperties shortly to look for more cases that aren't handled by default property synthesis. llvm-svn: 201878
* Objective-C. Fixes a bug where "new" family attributeFariborz Jahanian2014-01-281-1/+2
| | | | | | | was not being overridden in the category method implementation resulting in bogus warning. // rdar://15919775 llvm-svn: 200342
* ObjectiveC. Fixes a bug in recognition of an ivarFariborz Jahanian2014-01-271-9/+8
| | | | | | | backing a property resulting in bogus warning. // rdar://15890251 llvm-svn: 200254
* Rename getResultType() on function and method declarations to getReturnType()Alp Toker2014-01-251-54/+49
| | | | | | | | | | | | | | | 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
* ObjectiveC. When issuing property implementation isFariborz Jahanian2014-01-221-0/+7
| | | | | | | | not using backing ivar warning, ignore when property is not being synthesized (user declared its implementation @dynamic). // rdar://1583425 llvm-svn: 199820
* Distinguish between attributes explicitly written at the request of the ↵Aaron Ballman2014-01-161-8/+7
| | | | | | | | user, and attributes implicitly generated to assist in bookkeeping by the compiler. This is done so by table generating a CreateImplicit method for each attribute. Additionally, remove the optional nature of the spelling list index when creating attributes. This is supported by table generating a Spelling enumeration when the spellings for an attribute are distinct enough to warrant it. llvm-svn: 199378
* ObjectiveC. Remove warning on mismatched methodsFariborz Jahanian2014-01-101-47/+0
| | | | | | | | | which may belong to unrelated classes. It was primarily intended for miuse of @selector expression. But warning is too noisy and will be issued when an actual @selector is used. // rdar://15740134 llvm-svn: 198952
* Fix 80 col violation.Argyrios Kyrtzidis2014-01-031-1/+2
| | | | llvm-svn: 198444
* Pass the decl directly to the diagnostic, no need to call getDeclName().Argyrios Kyrtzidis2014-01-031-1/+1
| | | | llvm-svn: 198442
* [objc] Refactor and improve functionality for the -Wunused-property-ivar ↵Argyrios Kyrtzidis2014-01-031-25/+71
| | | | | | | | | | | | | | 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 llvm-svn: 198432
* ObjectiveC. Remove false positive warning for missing propertyFariborz Jahanian2014-01-021-3/+8
| | | | | | | backing ivar by not issuing this warning if ivar is referenced somewhere and accessor makes method calls. // rdar://15727325 llvm-svn: 198367
* ObjectiveC. Class methods must be ignored when looking forFariborz Jahanian2014-01-021-1/+2
| | | | | | | property accessor's missing backing ivar. This eliminates the bogus warning being issued. // rdar://15728901 llvm-svn: 198322
* ObjectiveC. typo fix in my last patch,Fariborz Jahanian2013-12-181-3/+1
| | | | | | per Jordan's review. llvm-svn: 197540
* Objctive-C. warn if dealloc is being overridden inFariborz Jahanian2013-12-171-0/+8
| | | | | | a category implementation. // rdar://15397430 llvm-svn: 197534
* Refine 'objc_protocol_requires_explicit_implementation' attribute to better ↵Ted Kremenek2013-12-131-3/+4
| | | | | | handle indirect protocols. llvm-svn: 197209
* Make 'CheckProtocolMethodDefs' a static function.Ted Kremenek2013-12-131-19/+21
| | | | llvm-svn: 197208
* Change 'method X in protocol not implemented' warning to include the name of ↵Ted Kremenek2013-12-131-8/+11
| | | | | | | | | the protocol. This removes an extra "note:", which wasn't really all that more useful and overall reduces the diagnostic spew for this case. llvm-svn: 197207
* Make 'WarnUndefinedMethod' a static function.Ted Kremenek2013-12-131-9/+10
| | | | llvm-svn: 197206
* ObjectiveC. Fixes a bug where an 'unused property ivar'Fariborz Jahanian2013-12-111-1/+1
| | | | | | | warning is coming out incorrectly too early becuase of unrelated scope pop. // rdar://15630719 llvm-svn: 196989
* Rename attribute 'objc_suppress_protocol_methods' to ↵Ted Kremenek2013-12-101-4/+4
| | | | | | | | | | | | | | | 'objc_protocol_requires_explicit_implementation'. That's a mouthful, and not necessarily the final name. This also reflects a semantic change where this attribute is now on the protocol itself instead of a class. This attribute will require that a protocol, when adopted by a class, is explicitly implemented by the class itself (instead of walking the super class chain). Note that this attribute is not "done". This should be considered a WIP. llvm-svn: 196955
* ObjectiveC: Don't warn when method implemented inFariborz Jahanian2013-12-051-11/+23
| | | | | | | | category is declared in category's primary class's super class. Because the super class is expected to implemented the method. // rdar://15580969 llvm-svn: 196531
* [objc] Add a warning when a class that provides a designated initializer, ↵Argyrios Kyrtzidis2013-12-031-1/+3
| | | | | | | | does not override all of the designated initializers of its superclass. llvm-svn: 196319
* [objc] Emit warning when the implementation of a secondary initializer calls onArgyrios Kyrtzidis2013-12-031-5/+10
| | | | | | | | | | | super another initializer and when the implementation does not delegate to another initializer via a call on 'self'. A secondary initializer is an initializer method not marked as a designated initializer within a class that has at least one initializer marked as a designated initializer. llvm-svn: 196318
* [objc] Emit a warning when the implementation of a designated initializer ↵Argyrios Kyrtzidis2013-12-031-0/+6
| | | | | | | | does not chain to an init method that is a designated initializer for the superclass. llvm-svn: 196316
* Fix inconsistent diag nameAlp Toker2013-12-021-2/+2
| | | | llvm-svn: 196061
* Add back experimental attribute objc_suppress_protocol_methods (slightly ↵Ted Kremenek2013-11-231-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | renamed). This is still an experimental attribute, but I wanted it in tree for review. It may still get yanked. This attribute can only be applied to a class @interface, not a class extension or category. It does not change the type system rules for Objective-C, but rather the implementation checking for Objective-C classes that explicitly conform to a protocol. During protocol conformance checking, clang recursively searches up the class hierarchy for the set of methods that compose a protocol. This attribute will cause the compiler to not consider the methods contributed by a super class, its categories, and those from its ancestor classes. Thus this attribute is used to force subclasses to redeclare (and hopefully re-implement) methods if they decide to explicitly conform to a protocol where some of those methods may be provided by a super class. This attribute intentionally leaves out properties, which are associated with state. This attribute only considers methods (at least right now) that are non-property accessors. These represent methods that "do something" as dictated by the protocol. This may be further refined, and this should be considered a WIP until documentation gets written or this gets removed. llvm-svn: 195533
* Change ObjCIntefaceDecl::lookupMethod() to have optional 'followsSuper' ↵Ted Kremenek2013-11-231-6/+17
| | | | | | | | | | | | | | argument. This enables a micro-optimization in protocol conformance checking to not examine the class hierarchy twice per method. As part of this change, remove the default arguments from lookupInstanceMethod() and lookupClassMethod(). It was becoming very redundant. For clients needing the default arguments, have them use the full API instead of these convenience methods. llvm-svn: 195532
* ObjectiveC. Remove warning diagnostic which checksFariborz Jahanian2013-11-231-67/+0
| | | | | | | | | | | | | | attribute on method declaration and implementation match. This makes no sense. Most annotations are meant for declarations only and one is for implementation. This has been constant source of regresions and hackery to get around special cases. I am removing this check. Such checks must be done on a case by case basis and when it makes sense. For example, it makes sense for availability/deprecated and I will file a radar for that. // rdar://15531984 llvm-svn: 195524
* Revert "Add new attribute 'objc_suppress_protocol' to suppress protocol ↵Ted Kremenek2013-11-211-9/+4
| | | | | | | | | | | conformance for a class." After implementing this patch, a few concerns about the language feature itself emerged in my head that I had previously not considered. I want to resolve those design concerns first before having a half-designed language feature in the tree. llvm-svn: 195328
* Add new attribute 'objc_suppress_protocol' to suppress protocol conformance ↵Ted Kremenek2013-11-211-4/+9
| | | | | | | | | | | | | | | | | | | | | | | for a class. The idea is to allow a class to stipulate that its methods (and those of its parents) cannot be used for protocol conformance in a subclass. A subclass is then explicitly required to re-implement those methods of they are present in the class marked with this attribute. Currently the attribute can only be applied to an @interface, and not a category or class extension. This is by design. Unlike protocol conformance, where a category can add explicit conformance of a protocol to class, this anti-conformance really needs to be observed uniformly by all clients of the class. That's because the absence of the attribute implies more permissive checking of protocol conformance. This unfortunately required changing method lookup in ObjCInterfaceDecl to take an optional protocol parameter. This should not slow down method lookup in most cases, and is just used for protocol conformance. llvm-svn: 195323
* ObjectiveC. Fixes a bogus warning of unused backingFariborz Jahanian2013-11-151-1/+10
| | | | | | | | ivar when property belongs to a super class and currnt class happens to have a method with same name as property. // rdar//15473432 llvm-svn: 194830
* ObjectiveC. Method implementations should only check forFariborz Jahanian2013-11-051-3/+1
| | | | | | | "Missing call to Super" in the overriding method and not in the method itself. // rdar://15385981. llvm-svn: 194031
* ObjectiveC: under -Wunused-property-ivar warn if property'sFariborz Jahanian2013-10-251-0/+31
| | | | | | | backing warning is not used in one of its accessor methods. // rdar://14989999 llvm-svn: 193439
* Reduce double set lookups by using the result of insert.Benjamin Kramer2013-10-141-8/+7
| | | | | | No functionality change. llvm-svn: 192598
* ObjectiveC: Handle the case of qualifying protocolsFariborz Jahanian2013-09-251-0/+23
| | | | | | | | | declared in a typedef declaraton used as super class of an ObjC class. Curretnly, these protocols are dropped from the class hierarchy. Test shows that it is now included. // rdar://15051465 llvm-svn: 191395
OpenPOWER on IntegriCloud