summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Revert my patch in r191155 to allow forwardFariborz Jahanian2013-09-241-12/+0
| | | | | | | | class/protocol decls in @implementation and fixup modern rewriter to handle that. // rdar://15066233 llvm-svn: 191311
* ObjectiveC: ObjC declarations, including forward classFariborz Jahanian2013-09-221-0/+12
| | | | | | and protocols can be at global scope only. llvm-svn: 191155
* Cleanup of OpaquePtr. No functionality changes.Serge Pavlov2013-08-271-2/+2
| | | | | | | | - Some documenation were added. - Usages of OpaquePtr<A>.getAsVal<A>() were replaced by OpaquePtr<A>.get(). - Methods getAs and getAsVal were renamed to getPtrTo and getPtrAs respectively. llvm-svn: 189346
* Refactor all diagnosing of TypoCorrections through a common function, inRichard Smith2013-08-171-27/+17
| | | | | | | preparation for teaching this function how to diagnose a correction that includes importing a module. llvm-svn: 188602
* ObjectiveC [Sema]. This patch makes sure that all inheritedFariborz Jahanian2013-08-141-0/+10
| | | | | | | | | | properties (direct or indirect) setter/getter (or declared methods as well) are seen by the method implementation type matching logic before declaration of method in super class is seen. This fixes the warning coming out of that method mismatch. // rdar://14650159 llvm-svn: 188438
* Omit llvm:: before SmallVector and SmallVectorImpl. We have using directive ↵Robert Wilhelm2013-08-101-1/+1
| | | | | | in include/clang/Basic/LLVM.h. llvm-svn: 188138
* Even more code conformance.Robert Wilhelm2013-07-171-1/+1
| | | | llvm-svn: 186537
* More code conformance.Fariborz Jahanian2013-07-171-1/+1
| | | | llvm-svn: 186474
* This patch removes unused parameter allProperties and converts remainingFariborz Jahanian2013-07-161-10/+6
| | | | | | | parameters in ArrayRef'ize Sema::ActOnAtEnd to ArrayRef. Patch by Robert Wilhelm. llvm-svn: 186421
* Objective-C: merge objc_requires_super attribute ofFariborz Jahanian2013-07-091-1/+9
| | | | | | | | | method declaration into its implementation to prevent a bogus warning about mismatched attributes. then make sure the warning about missing call to super comes out of the method implementation. // rdar://14251387 llvm-svn: 185974
* ArrayRef'ize Sema::FinalizeDeclaratorGroup, Sema::BuildDeclaratorGroup andRafael Espindola2013-07-091-4/+4
| | | | | | | | Sema::ActOnDocumentableDecls. Patch by Robert Wilhelm. llvm-svn: 185931
* Remove some useless declarations (found by scan-build)Sylvestre Ledru2013-07-061-1/+0
| | | | llvm-svn: 185752
* ObjectiveC: diagnose duplicate declaration ofFariborz Jahanian2013-06-261-0/+13
| | | | | | | private ivars in class extensions and class @implementation. // rdar://14278560 llvm-svn: 185025
* Don't use unnamed local enums as template arguments.Joerg Sonnenberger2013-06-261-2/+2
| | | | | | Fixes -Werror bootstrap. llvm-svn: 185023
* [Sema] Call CheckParmForFunctionDef on ObjC method parametersReid Kleckner2013-06-241-4/+4
| | | | | | | CheckParmForFunctionDef performs standard checks for type completeness and other things like a destructor check for the MSVC++ ABI. llvm-svn: 184740
* Delete dead code.Eli Friedman2013-06-211-7/+0
| | | | llvm-svn: 184520
* Delete dead code.Eli Friedman2013-06-211-4/+1
| | | | llvm-svn: 184517
* When building a module, keep *all* declared methods in the global method pool.Douglas Gregor2013-06-211-0/+4
| | | | | | | | | | | | | | | | | As an optimization, we only kept declared methods with distinct signatures in the global method pool, to keep the method lists small. Under modules, however, one could have two different methods with the same signature that occur in different (sub)modules. If only the later submodule is important, message sends to 'id' with that selector would fail because the first method (the only one that got into the method pool) was hidden. When building a module, keep *all* of the declared methods. I did a quick check of both module build time and uses of modules, and found no performance regression despite this causing us to keep more methods in the global method pool. Fixes <rdar://problem/14148896>. llvm-svn: 184504
* When declaring an ObjC interface decl with a @compatibility_alias alias ↵Argyrios Kyrtzidis2013-06-181-1/+36
| | | | | | | | | | | | | | | | | | name, change the class name to the "real" one. If we have something like @class NewImage; @compatibility_alias OldImage NewImage; @class OldImage; the lookup for 'OldImage' will return the 'NewImage' decl ("@class NewImage"). In such a case, when creating the decl for "@class OldImage" use the real declaration name ("NewImage"), instead of the alias one ("OldImage"), otherwise we will break IdentifierResolver and redecls-chain invariants. Fixes crash of rdar://14112291. llvm-svn: 184238
* Objective-C: Fixes a typo correction bug where aFariborz Jahanian2013-06-181-2/+4
| | | | | | | selector would be correted to identical selector name in certain corner cases. // rdar://7853549 llvm-svn: 184208
* Objective-C [qoi]: privide typo correction for selectorsFariborz Jahanian2013-06-181-6/+30
| | | | | | | | in addition of receiver having static type, but also when receiver has dynamic type (of 'id' variety) as well as when receiver is of 'Class' type vareity. // rdar://7853549 llvm-svn: 184195
* Objective-C [qoi]: Provide fixit hint when message with typoFariborz Jahanian2013-06-171-3/+15
| | | | | | is sent to a receiver object. This is wip. // rdar://7853549 llvm-svn: 184086
* Unify return type checking for functions and ObjC methods. Move all theEli Friedman2013-06-141-14/+3
| | | | | | | | random checks for ObjC object return types to SemaType.cpp. Fixes issue with ObjC method type checking reported on cfe-dev. llvm-svn: 184006
* Don't create a StringRef from a temporary string.Richard Trieu2013-06-061-1/+1
| | | | llvm-svn: 183372
* Objective-C: Provide fixit with suggested spelling correctionFariborz Jahanian2013-06-051-0/+51
| | | | | | for -Wundeclared-selector warnings. // rdar://14039037 llvm-svn: 183331
* fixes a comment in my last patch.Fariborz Jahanian2013-05-301-1/+1
| | | | llvm-svn: 182966
* Objective-C: Implements gcc's -Wselector optionFariborz Jahanian2013-05-301-1/+48
| | | | | | | | which diagnoses type mismatches of identical selectors declared in classes throughout. // rdar://14007194 llvm-svn: 182964
* Fix potential infinite loop when iterating over redeclarations of an ↵Argyrios Kyrtzidis2013-05-301-0/+2
| | | | | | | | | | | ObjMethodDecl, resulting from invalid code. Check for invalid decls in ObjCMethodDecl::getNextRedeclaration(); otherwise if we start from an invalid redeclaration of an @implementation we would move to the @interface and not reach the original declaration again. Fixes rdar://14024851 llvm-svn: 182951
* Objective-C arc: Diagnose when user attempts toFariborz Jahanian2013-05-161-1/+1
| | | | | | | | synthesize a property getter method that overrides a method definition named 'retain' and the like. Fixes // rdar://13885083 llvm-svn: 182039
* Use only explicit bool conversion operatorDavid Blaikie2013-05-151-1/+1
| | | | | | | | | | | | | | | | | | | The most common (non-buggy) case are where such objects are used as return expressions in bool-returning functions or as boolean function arguments. In those cases I've used (& added if necessary) a named function to provide the equivalent (or sometimes negative, depending on convenient wording) test. DiagnosticBuilder kept its implicit conversion operator owing to the prevalent use of it in return statements. One bug was found in ExprConstant.cpp involving a comparison of two PointerUnions (PointerUnion did not previously have an operator==, so instead both operands were converted to bool & then compared). A test is included in test/SemaCXX/constant-expression-cxx1y.cpp for the fix (adding operator== to PointerUnion in LLVM). llvm-svn: 181869
* Objective-C error recovery. This patch makes a quickFariborz Jahanian2013-05-131-0/+2
| | | | | | | | | recovery form duplicate method definition error thus preventing doc parsing to loop trying to find comment for the invalid redefinition in a previous declaration. // rdar://13836387 llvm-svn: 181710
* Keep track of an @implementation's super class name location, if one was ↵Argyrios Kyrtzidis2013-05-031-1/+1
| | | | | | provided. llvm-svn: 181039
* Fix an assertion hit in Sema::CheckObjCMethodOverrides.Argyrios Kyrtzidis2013-04-271-4/+6
| | | | llvm-svn: 180651
* Objective-C: When reporting on missing property accessor implementation inFariborz Jahanian2013-04-241-12/+2
| | | | | | | | categories, do not report when they are declared in primary class, class's protocol, or one of it super classes. This is because, its class is going to implement them. // rdar://13713098 llvm-svn: 180198
* Use the extra info in global method pool to speed up looking for ObjC ↵Argyrios Kyrtzidis2013-04-171-4/+40
| | | | | | | | | | | | | | | | | | overridden methods. When we are in a implementation, we check the global method pool whether there were category methods with the same selector. If there were none (common case) we don't need to do lookups for overridden methods again. Note that for an interface method (if we don't encounter its implementation), it is considered that it overrides methods that were declared before it, not for category methods introduced after it. This is tradeoff in favor of performance, since it is expensive to do lookups in case there was a category, and moving the global method pool to ASTContext (so we can check it) would increase complexity. rdar://13508196 llvm-svn: 179654
* Enhance the ObjC global method pool to record whether there were 0, 1, or >= ↵Argyrios Kyrtzidis2013-04-171-4/+10
| | | | | | | | | 2 methods (with a particular selector) inside categories. This is done by extending ObjCMethodList (which is only used by the global method pool) to have 2 extra bits of information. We will later take advantage of this info in global method pool for the overridden methods calculation. llvm-svn: 179652
* Parsing support for thread_local and _Thread_local. We give them the sameRichard Smith2013-04-121-5/+7
| | | | | | semantics as __thread for now. llvm-svn: 179424
* Objective-C: This patch fixes a none-issuance of warningFariborz Jahanian2013-04-091-1/+4
| | | | | | | | | | | when result type of protocol property and getter method differ by fixing a more serious problem. When a forward protocol declaration comes between its definition and its use in class protocol list, the forward protocol ast was being used in building the protocol list. // rdar://12522752 llvm-svn: 179108
* Objective-C: Issue deprecated warning when using a Fariborz Jahanian2013-04-041-1/+7
| | | | | | | deprecated typedef to subclass or invoke a class method. // rdar://13569424 llvm-svn: 178775
* Be sure to check ARC conventions on the implicit method declarationsJohn McCall2013-04-041-10/+10
| | | | | | | | | of a property just in case the property's getter happens to be +1. We won't synthesize a getter for such a property, but we will allow the user to define a +1 method for it. rdar://13115896 llvm-svn: 178731
* Add 178663 back.Rafael Espindola2013-04-031-2/+2
| | | | | | | | | | | http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb went back green before it processed the reverted 178663, so it could not have been the culprit. Revert "Revert 178663." This reverts commit 4f8a3eb2ce5d4ba422483439e20c8cbb4d953a41. llvm-svn: 178682
OpenPOWER on IntegriCloud