summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [PATCH Sema Objective-C]. Patch to warn on missing designated initializerFariborz Jahanian2015-03-091-0/+10
| | | | | | | override where at least a declaration of a designated initializer is in a super class and not necessarily in the current class. rdar://19653785. llvm-svn: 231700
* Fix ObjCInterfaceDecl::getCategoryMethod() and give it a caller. No behavior ↵Nico Weber2015-03-021-2/+1
| | | | | | change. llvm-svn: 230928
* Cleanup: remove artificial division between lookup results and const lookupRichard Smith2015-02-211-8/+8
| | | | | | | results. No-one was ever modifying a lookup result, and it would not be reasonable to do so. llvm-svn: 230123
* Prefer SmallVector::append/insert over push_back loops. Clang edition.Benjamin Kramer2015-02-171-3/+2
| | | | | | Same functionality, but hoists the vector growth out of the loop. llvm-svn: 229508
* ObjC getters with names like "newItem" should still be linked to the @property.Jordan Rose2015-01-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Two years ago I added a compile-time "optimization" to ObjCMethodDecl::findPropertyDecl: exit early if the current method is part of a special Objective-C method family (like 'new' or 'init'). However, if a property (declared with @property) has a name that matches a method family, the getter picks up that family despite being declared by the property. The early exit then made ObjCMethodDecl::findPropertyDecl decide that there was no associated property, despite the method itself being marked as an accessor. This corrects that by removing the early exit. This does /not/ change the fact that such a getter is considered to return a value with a +1 retain count. The best way to eliminate this is by adding the objc_method_family(none) attribute to the getter, but unlike the existing ns_returns_not_retained that can't be applied directly to the property -- you have to redeclare the getter instead. (It'd be nice if @property just implied objc_method_family(none) for its getter, but that would be a backwards-incompatible change.) rdar://problem/19038838 llvm-svn: 226338
* Wrap to 80 columns. NfC.Nico Weber2014-12-221-10/+11
| | | | llvm-svn: 224695
* Constify a few IdentifierInfo * parameters.Jordan Rose2014-11-191-3/+3
| | | | | | No functionality change. llvm-svn: 222392
* Objective-C. Change to method lookup rules to lookFariborz Jahanian2014-08-271-12/+15
| | | | | | | | | | into primary class's named categories before looking into their protocols. This is because categories are part of the public interface and , just as primary class, preference should be given to them before class (and category) protocols. // rdar://18013929 llvm-svn: 216610
* Objective-C. Warn if user has made explicit callFariborz Jahanian2014-08-221-0/+5
| | | | | | | to +initilize as this results in an extra call to this method. rdar://16628028 llvm-svn: 216271
* Improving diagnostic source ranges for the nonnull attribute. Now it ↵Aaron Ballman2014-08-011-0/+7
| | | | | | highlights the attribute and the faulty nonpointer type when possible. llvm-svn: 214507
* Objective-C. Changes per A. Ballman's commentFariborz Jahanian2014-07-161-10/+12
| | | | | | for my last patch. // rdar://17631257 llvm-svn: 213185
* Objective-C. Introducing __attribute__((objc_runtime_name("runtimename"))Fariborz Jahanian2014-07-161-0/+23
| | | | | | | | | to be applied to class or protocols. This will direct IRGen for Objective-C metadata to use the new name in various places where class and protocol names are needed. rdar:// 17631257 llvm-svn: 213167
* If a declaration is loaded, and then a module import adds a redeclaration, thenRichard Smith2014-05-161-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ensure that querying the first declaration for its most recent declaration checks for redeclarations from the imported module. This works as follows: * The 'most recent' pointer on a canonical declaration grows a pointer to the external AST source and a generation number (space- and time-optimized for the case where there is no external source). * Each time the 'most recent' pointer is queried, if it has an external source, we check whether it's up to date, and update it if not. * The ancillary data stored on the canonical declaration is allocated lazily to avoid filling it in for declarations that end up being non-canonical. We'll still perform a redundant (ASTContext) allocation if someone asks for the most recent declaration from a decl before setPreviousDecl is called, but such cases are probably all bugs, and are now easy to find. Some finessing is still in order here -- in particular, we use a very general mechanism for handling the DefinitionData pointer on CXXRecordData, and a more targeted approach would be more compact. Also, the MayHaveOutOfDateDef mechanism should now be expunged, since it was addressing only a corner of the full problem space here. That's not covered by this patch. Early performance benchmarks show that this makes no measurable difference to Clang performance without modules enabled (and fixes a major correctness issue with modules enabled). I'll revert if a full performance comparison shows any problems. llvm-svn: 209046
* [C++11] Use 'nullptr'. AST edition.Craig Topper2014-05-121-74/+83
| | | | llvm-svn: 208517
* Stop all the Decl classes poking at Redeclarable's data member directly, and ↵Richard Smith2014-05-101-1/+1
| | | | | | make getNextRedeclaration follow the pattern of its friends getPreviousDecl and getMostRecentDecl. llvm-svn: 208467
* [SemaObjC] Fix ObjCInterfaceDecl::inheritsDesignatedInitializers(), if there ↵Argyrios Kyrtzidis2014-04-261-3/+13
| | | | | | | | | | are no designated initializers in the super class hierarchy then it should return false. rdar://16692535 llvm-svn: 207332
* Fix indentation, NFC.Argyrios Kyrtzidis2014-04-161-4/+4
| | | | llvm-svn: 206411
* [objc] Consider new initializers inside @implementation when determining if ↵Argyrios Kyrtzidis2014-04-161-0/+6
| | | | | | | | | | the class introduces new initializers. Part of rdar://16568441 llvm-svn: 206409
* [SemaObjC] For the semantics of the designated-initializer attribute, ↵Argyrios Kyrtzidis2014-03-281-9/+30
| | | | | | | | | | consider that the ObjC interface of the class includes its class extensions. This is follow-up for rdar://16305347 llvm-svn: 205065
* [C++11] Replacing ObjCImplementationDecl iterators ivar_begin() and ↵Aaron Ballman2014-03-141-6/+4
| | | | | | ivar_end() with iterator_range ivars(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203932
* [C++11] Replacing ObjCCategoryDecl iterators propimpl_begin() and ↵Aaron Ballman2014-03-141-6/+2
| | | | | | propimpl_end() with iterator_range property_impls(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203930
* [C++11] Replacing ObjCCategoryDecl iterators protocol_begin() and ↵Aaron Ballman2014-03-141-13/+7
| | | | | | protocol_end() with iterator_range protocols(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203922
* [C++11] Replacing ObjCProtocolDecl iterators protocol_begin() and ↵Aaron Ballman2014-03-131-21/+14
| | | | | | protocol_end() with iterator_range protocols(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203863
* [C++11] Replacing ObjCInterfaceDecl iterators known_extensions_begin() and ↵Aaron Ballman2014-03-131-4/+1
| | | | | | known_extensions_end() with iterator_range known_extensions(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203857
* [C++11] Replacing ObjCInterfaceDecl iterators visible_extensions_begin() and ↵Aaron Ballman2014-03-131-4/+1
| | | | | | visible_extensions_end() with iterator_range visible_extensions(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203855
* [C++11] Replacing ObjCInterfaceDecl iterators known_categories_begin() and ↵Aaron Ballman2014-03-131-7/+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-33/+10
| | | | | | 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 ↵Aaron Ballman2014-03-131-29/+14
| | | | | | 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 ObjCInterfaceDecl iterators protocol_begin() and ↵Aaron Ballman2014-03-131-12/+7
| | | | | | | | protocol_end() with iterator_range protocols(). Updating all of the usages of the iterators with range-based for loops. Drive-by fixing some incorrect types where a for loop would be improperly using ObjCInterfaceDecl::protocol_iterator. No functional changes in these cases. llvm-svn: 203842
* [C++11] Replacing ObjCContainerDecl iterators instmeth_begin() and ↵Aaron Ballman2014-03-131-7/+2
| | | | | | 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-5/+5
| | | | | | for clarity. llvm-svn: 203835
* [C++11] Replacing ObjCContainerDecl iterators prop_begin() and prop_end() ↵Aaron Ballman2014-03-131-17/+8
| | | | | | with iterator_range props(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203830
* Objective-C. Prevent an assertion crash due to buggy codeFariborz Jahanian2014-03-111-4/+12
| | | | | | as it can commonly happen. // rdar://16261494 llvm-svn: 203598
* [C++11] Replacing iterators redecls_begin() and redecls_end() with ↵Aaron Ballman2014-03-061-5/+3
| | | | | | 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
* Objective-C. Return 0 as class of methods in protocols.Fariborz Jahanian2014-03-041-2/+2
| | | | | | | This simplifies my last patch a bit. No change in functionality. llvm-svn: 202906
* Remove obsolete ObjCMethodDecl arg_type iterator functionsAlp Toker2014-01-251-1/+1
| | | | | | These were set into deprecation in r199773. llvm-svn: 200086
* Rename getResultType() on function and method declarations to getReturnType()Alp Toker2014-01-251-18/+10
| | | | | | | | | | | | | | | 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
* Rename FunctionProtoType accessors from 'arguments' to 'parameters'Alp Toker2014-01-201-1/+1
| | | | | | | | | | | | | | | | | Fix a perennial source of confusion in the clang type system: Declarations and function prototypes have parameters to which arguments are supplied, so calling these 'arguments' was a stretch even in C mode, let alone C++ where default arguments, templates and overloading make the distinction important to get right. Readability win across the board, especially in the casting, ADL and overloading implementations which make a lot more sense at a glance now. Will keep an eye on the builders and update dependent projects shortly. No functional change. llvm-svn: 199686
* Distinguish between attributes explicitly written at the request of the ↵Aaron Ballman2014-01-161-1/+1
| | | | | | | | 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
* [objc] Refactor and improve functionality for the -Wunused-property-ivar ↵Argyrios Kyrtzidis2014-01-031-5/+3
| | | | | | | | | | | | | | 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
* Rename attribute 'objc_suppress_protocol_methods' to ↵Ted Kremenek2013-12-101-20/+1
| | | | | | | | | | | | | | | '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
* [AST] In ObjCInterfaceDecl::isDesignatedInitializer(), use getMethod() ↵Argyrios Kyrtzidis2013-12-101-3/+1
| | | | | | | | instead of lookupMethod(). lookupMethod also goes through categories, which we don't need there. llvm-svn: 196942
* [objc] If an interface has no initializer marked as designated and ↵Argyrios Kyrtzidis2013-12-051-14/+48
| | | | | | | | | | | introduces at least one new initializer, don't assume that it inherits the designated initializers from the super class. If the assumption was wrong because a new initializer was a designated one that was not marked as such, we will emit misleading warnings for subclasses of the interface. llvm-svn: 196476
* [objc] Emit warning when the implementation of a secondary initializer calls onArgyrios Kyrtzidis2013-12-031-0/+8
| | | | | | | | | | | 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 warnings when the implementation of a designated initializer ↵Argyrios Kyrtzidis2013-12-031-2/+5
| | | | | | | | calls on super an initializer that is not a designated one or any initializer on self. llvm-svn: 196317
* [objc] Emit a warning when the implementation of a designated initializer ↵Argyrios Kyrtzidis2013-12-031-2/+43
| | | | | | | | does not chain to an init method that is a designated initializer for the superclass. llvm-svn: 196316
* [objc] Introduce ObjCInterfaceDecl::getDesignatedInitializers() to get theArgyrios Kyrtzidis2013-12-031-0/+29
| | | | | | | | | | designated initializers of an interface. If the interface declaration does not have methods marked as designated initializers then the interface inherits the designated initializers of its super class. llvm-svn: 196315
* Use specific_attr_iterator to tighten loop over ObjCSuppressProtocolAttrs.Ted Kremenek2013-11-231-8/+4
| | | | llvm-svn: 195561
* Move logic to check if a class is tagged with objc_suppress_protocol_methods ↵Ted Kremenek2013-11-231-12/+18
| | | | | | into a helper. llvm-svn: 195559
* Add back experimental attribute objc_suppress_protocol_methods (slightly ↵Ted Kremenek2013-11-231-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud