summaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclObjC.cpp
Commit message (Collapse)AuthorAge
* Hide the concept of diagnostic levels from lex, parse and semaAlp Toker2014-06-15
| | | | | | | | | | | | | | | | 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
* [C++11] Use 'nullptr'. Sema edition.Craig Topper2014-05-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209613 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bunch of mislayered clang/Lex includes from SemaAlp Toker2014-05-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207896 91177308-0d34-0410-b5e6-96231b3b80d8
* Initial implementation of -modules-earch-all option, for searching for ↵John Thompson2014-04-23
| | | | | | symbols in non-imported modules. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206977 91177308-0d34-0410-b5e6-96231b3b80d8
* Objective-C. Fixes a bogus warning on unimplementedFariborz Jahanian2014-03-26
| | | | | | | | | selectors because we were not going through entire elements in list of all implemented selectors. // rdar://16428638 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204852 91177308-0d34-0410-b5e6-96231b3b80d8
* Objective-C. Better fix for my previous patch Fariborz Jahanian2014-03-18
| | | | | | | | | | "No need to issue deprecated warning if deprecated method in class extension is being implemented in primary class implementation (no overriding is involved). // rdar://16249335". No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204159 91177308-0d34-0410-b5e6-96231b3b80d8
* Objective-C. No need to issue deprecated warning if deprecated method Fariborz Jahanian2014-03-18
| | | | | | | | | in class extension is being implemented in primary class implementation (no overriding is involved). // rdar://16249335 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204093 91177308-0d34-0410-b5e6-96231b3b80d8
* Objective-C. Do not warn when an instance method andFariborz Jahanian2014-03-17
| | | | | | | | | class method with the same selctor but different argument types having one of them in class extension. // rdar://16312105 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204065 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing ObjCObjectType iterators qual_begin() and qual_end() with ↵Aaron Ballman2014-03-17
| | | | | | 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
* Objective-C. Redo turning off designated initialization warnings onFariborz Jahanian2014-03-14
| | | | | | | | | 'init' methods which are unavailable. Subclasses of NSObject have to implement such methods as a common pattern to prevent user's own implementation. // rdar://16305460 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203984 91177308-0d34-0410-b5e6-96231b3b80d8
* Objective-C. Turn off designated initialization warnings onFariborz Jahanian2014-03-14
| | | | | | | | | 'init' methods which are unavailable. Subclasses of NSObject have to implement such methods as a common pattern to prevent user's own implementation. // rdar://16305460 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203966 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing ObjCCategoryDecl iterators protocol_begin() and ↵Aaron Ballman2014-03-14
| | | | | | protocol_end() with iterator_range protocols(). Updating all of the usages of the iterators with range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203922 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing ObjCProtocolDecl iterators protocol_begin() and ↵Aaron Ballman2014-03-13
| | | | | | protocol_end() with iterator_range protocols(). Updating all of the usages of the iterators with range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203863 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing ObjCInterfaceDecl iterators visible_extensions_begin() and ↵Aaron Ballman2014-03-13
| | | | | | visible_extensions_end() with iterator_range visible_extensions(). Updating all of the usages of the iterators with range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203855 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing ObjCInterfaceDecl iterators known_categories_begin() and ↵Aaron Ballman2014-03-13
| | | | | | known_categories_end() with iterator_range known_categories(). Updating all of the usages of the iterators with range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203854 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing ObjCInterfaceDecl iterators visible_categories_begin() and ↵Aaron Ballman2014-03-13
| | | | | | visible_categories_end() with iterator_range visible_categories(). Updating all of the usages of the iterators with range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203851 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing ObjCInterfaceDecl iterators ivar_begin() and ivar_end() ↵Aaron Ballman2014-03-13
| | | | | | with iterator_range ivars(). Updating all of the usages of the iterators with range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203849 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing ObjCInterfaceDecl iterators ↵Aaron Ballman2014-03-13
| | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203848 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing ObjCContainerDecl iterators classmeth_begin() and ↵Aaron Ballman2014-03-13
| | | | | | classmeth_end() with iterator_range class_methods(). Updating all of the usages of the iterators with range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203840 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing ObjCContainerDecl iterators instmeth_begin() and ↵Aaron Ballman2014-03-13
| | | | | | instmeth_end() with iterator_range instance_methods(). Updating all of the usages of the iterators with range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203839 91177308-0d34-0410-b5e6-96231b3b80d8
* Renaming the recently-created (r203830) props() range API to properties() ↵Aaron Ballman2014-03-13
| | | | | | for clarity. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203835 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing ObjCContainerDecl iterators meth_begin() and meth_end() ↵Aaron Ballman2014-03-13
| | | | | | with iterator_range methods(). Updating all of the usages of the iterators with range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203832 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing ObjCContainerDecl iterators prop_begin() and prop_end() ↵Aaron Ballman2014-03-13
| | | | | | with iterator_range props(). Updating all of the usages of the iterators with range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203830 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-12
| | | | | | class. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203640 91177308-0d34-0410-b5e6-96231b3b80d8
* Objective-C. Diagose use of undefined protocolsFariborz Jahanian2014-03-11
| | | | | | | | when a class adopts a protocol that inherits from undefined protocols. // rdar://16111182 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203586 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Remove the remaining uses of OwningPtr.Ahmed Charles2014-03-09
| | | | | | Replace OwningArrayPtr with std::unique_ptr<T[]>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203388 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing ObjCMethodDecl iterators param_begin() and param_end() ↵Aaron Ballman2014-03-07
| | | | | | with iterator_range params(). Updating all of the usages of the iterators with range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203255 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix recursion bug in logic to validate ↵Ted Kremenek2014-03-05
| | | | | | 'objc_protocol_requires_explicit_implementation' conformance. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203024 91177308-0d34-0410-b5e6-96231b3b80d8
* Adjust logic for 'objc_protocol_requires_explicit_implementation' for ↵Ted Kremenek2014-03-05
| | | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202948 91177308-0d34-0410-b5e6-96231b3b80d8
* [ObjC] Change default property synthesis logic to not completely skip ↵Ted Kremenek2014-02-21
| | | | | | | | | DiagnoseUnimplementedProperties. We're going to extend DiagnoseUnimplementedProperties shortly to look for more cases that aren't handled by default property synthesis. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201878 91177308-0d34-0410-b5e6-96231b3b80d8
* Objective-C. Fixes a bug where "new" family attributeFariborz Jahanian2014-01-28
| | | | | | | | was not being overridden in the category method implementation resulting in bogus warning. // rdar://15919775 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200342 91177308-0d34-0410-b5e6-96231b3b80d8
* ObjectiveC. Fixes a bug in recognition of an ivarFariborz Jahanian2014-01-27
| | | | | | | | backing a property resulting in bogus warning. // rdar://15890251 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200254 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename getResultType() on function and method declarations to getReturnType()Alp Toker2014-01-25
| | | | | | | | | | | | | | | 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
* ObjectiveC. When issuing property implementation isFariborz Jahanian2014-01-22
| | | | | | | | | not using backing ivar warning, ignore when property is not being synthesized (user declared its implementation @dynamic). // rdar://1583425 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199820 91177308-0d34-0410-b5e6-96231b3b80d8
* Distinguish between attributes explicitly written at the request of the ↵Aaron Ballman2014-01-16
| | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199378 91177308-0d34-0410-b5e6-96231b3b80d8
* ObjectiveC. Remove warning on mismatched methodsFariborz Jahanian2014-01-10
| | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198952 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix 80 col violation.Argyrios Kyrtzidis2014-01-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198444 91177308-0d34-0410-b5e6-96231b3b80d8
* Pass the decl directly to the diagnostic, no need to call getDeclName().Argyrios Kyrtzidis2014-01-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198442 91177308-0d34-0410-b5e6-96231b3b80d8
* [objc] Refactor and improve functionality for the -Wunused-property-ivar ↵Argyrios Kyrtzidis2014-01-03
| | | | | | | | | | | | | | 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
* ObjectiveC. Remove false positive warning for missing propertyFariborz Jahanian2014-01-02
| | | | | | | | 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
* ObjectiveC. Class methods must be ignored when looking forFariborz Jahanian2014-01-02
| | | | | | | | property accessor's missing backing ivar. This eliminates the bogus warning being issued. // rdar://15728901 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198322 91177308-0d34-0410-b5e6-96231b3b80d8
* ObjectiveC. typo fix in my last patch,Fariborz Jahanian2013-12-18
| | | | | | | per Jordan's review. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197540 91177308-0d34-0410-b5e6-96231b3b80d8
* Objctive-C. warn if dealloc is being overridden inFariborz Jahanian2013-12-17
| | | | | | | a category implementation. // rdar://15397430 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197534 91177308-0d34-0410-b5e6-96231b3b80d8
* Refine 'objc_protocol_requires_explicit_implementation' attribute to better ↵Ted Kremenek2013-12-13
| | | | | | handle indirect protocols. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197209 91177308-0d34-0410-b5e6-96231b3b80d8
* Make 'CheckProtocolMethodDefs' a static function.Ted Kremenek2013-12-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197208 91177308-0d34-0410-b5e6-96231b3b80d8
* Change 'method X in protocol not implemented' warning to include the name of ↵Ted Kremenek2013-12-13
| | | | | | | | | the protocol. This removes an extra "note:", which wasn't really all that more useful and overall reduces the diagnostic spew for this case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197207 91177308-0d34-0410-b5e6-96231b3b80d8
* Make 'WarnUndefinedMethod' a static function.Ted Kremenek2013-12-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197206 91177308-0d34-0410-b5e6-96231b3b80d8
* ObjectiveC. Fixes a bug where an 'unused property ivar'Fariborz Jahanian2013-12-11
| | | | | | | | warning is coming out incorrectly too early becuase of unrelated scope pop. // rdar://15630719 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196989 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename attribute 'objc_suppress_protocol_methods' to ↵Ted Kremenek2013-12-10
| | | | | | | | | | | | | | | '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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196955 91177308-0d34-0410-b5e6-96231b3b80d8
* ObjectiveC: Don't warn when method implemented inFariborz Jahanian2013-12-05
| | | | | | | | | category is declared in category's primary class's super class. Because the super class is expected to implemented the method. // rdar://15580969 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196531 91177308-0d34-0410-b5e6-96231b3b80d8