summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
* objective-c: this patch (re)introduces objective-c's default propertyFariborz Jahanian2011-08-311-4/+0
| | | | | | | | | | synthesis. This new feature is currently placed under -fobjc-default-synthesize-properties option and is off by default pending further testing. It will become the default feature soon. // rdar://8843851 llvm-svn: 138913
* objective-c - This patch buffers method implementations Fariborz Jahanian2011-08-311-6/+14
| | | | | | | | | | | | | and does the Sema on their body after the entire class/category @implementation is seen. This change allows messaging of forward private methods, as well as, access to synthesized ivars of properties with foward synthesize declarations; among others. In effect, this patch removes several restrictions placed on objective-c due to in-place semantics processing of methods. This is part of // rdar://8843851. llvm-svn: 138865
* Remove a few mutating ObjCCategoryDecl methods.Argyrios Kyrtzidis2011-08-301-19/+10
| | | | | | | | | | | Remove -setClassInterface -setNextClassCategory -insertNextClassCategory and combine them in the Create function. llvm-svn: 138817
* Remove a couple of unnecessary objc method lookups.Argyrios Kyrtzidis2011-08-301-7/+7
| | | | llvm-svn: 138815
* Do not warn about [super finalize] in arc mode.Nico Weber2011-08-291-1/+3
| | | | llvm-svn: 138776
* Minor clean up of objc's decl context stuff.Fariborz Jahanian2011-08-291-0/+1
| | | | | | No change in functionality. llvm-svn: 138742
* Warn on missing [super finalize] calls.Nico Weber2011-08-281-2/+8
| | | | | | This matches gcc's logic. Second half of PR10661. llvm-svn: 138730
* objective-c: Treat top-level objective-c declarationsFariborz Jahanian2011-08-271-13/+9
| | | | | | | | | | , such as list of forward @class decls, in a DeclGroup node. Deal with its consequence throught clang. This is in preparation for more Sema work ahead. // rdar://8843851. Feel free to reverse if it breaks something important and I am unavailable. llvm-svn: 138709
* Don't warn on category implementing a method, if Fariborz Jahanian2011-08-251-1/+1
| | | | | | | declated method in the class belongs to a synthesized property getter/setter. // rdar://10014946 llvm-svn: 138598
* objc - fix a bug exposed by my recent decl contextFariborz Jahanian2011-08-251-0/+3
| | | | | | changes. // rdar://10015110 llvm-svn: 138594
* Reverse r138567 until a buildbot failure is investigated.Fariborz Jahanian2011-08-251-11/+11
| | | | llvm-svn: 138584
* Fixes a typo in my last patch.Fariborz Jahanian2011-08-251-1/+1
| | | | llvm-svn: 138571
* objc -arse: Use DeclGroup for forward class declarations;Fariborz Jahanian2011-08-251-11/+11
| | | | | | as in @class foo, bar. More cleanup to follow. llvm-svn: 138567
* Do not perform check for missing '[super dealloc]' under ARC as calling ↵Ted Kremenek2011-08-221-1/+3
| | | | | | -dealloc is illegal in that mode. llvm-svn: 138261
* objc - minor comment fix up and cleanup.Fariborz Jahanian2011-08-221-2/+2
| | | | llvm-svn: 138253
* Warn on missing [super dealloc] calls.Nico Weber2011-08-221-3/+11
| | | | | | This matches gcc's logic. Half of PR10661. llvm-svn: 138240
* Restore patch I reversed in r138040. Known buildbotFariborz Jahanian2011-08-221-9/+15
| | | | | | failures are resolved. llvm-svn: 138234
* Revers r138040. Need to look at a few buildbot failures.Fariborz Jahanian2011-08-191-15/+9
| | | | llvm-svn: 138049
* objective-c: Bring objective-c handling of decl contextFariborz Jahanian2011-08-191-9/+15
| | | | | | | | | | to modernity. Instead of passing down individual context objects from parser to sema, establish decl context in parser and have sema access current context as needed. I still need to take of Doug's comment for minor cleanups. llvm-svn: 138040
* Mark objc methods that are implicitly declared for properties (not ↵Argyrios Kyrtzidis2011-08-171-1/+2
| | | | | | | | user-declared) as implicit. This results in libclang ignoring such methods. llvm-svn: 137852
* objective-c: Using existing infrastructure for finding Fariborz Jahanian2011-08-101-266/+51
| | | | | | | | | overridden methods to diagnose their type mismatch. This is a general solution for previous fixes for // rdar://6191214 and // rdar://9352731 and removes lots of duplicate code. llvm-svn: 137222
* objective-c: diagnose protocol inconsistencies in following Fariborz Jahanian2011-08-081-1/+138
| | | | | | | | | situation. When a class explicitly or implicitly (through inheritance) "conformsTo" two protocols which conflict (have methods which conflict). This patch fixes the previous patch where warnings were coming out in non-deterministic order. This is 2nd part of // rdar://6191214. llvm-svn: 137055
* Silence the category-replacing-class-method warning for +load: categoryDavid Chisnall2011-08-081-0/+3
| | | | | | | | implementations of +load do not replace the class definition in a meaningful sense, they are run when the category loads, the +load method for class is run when the class is loaded. llvm-svn: 137053
* Revert 136984 and 136927.Ted Kremenek2011-08-051-126/+1
| | | | llvm-svn: 136998
* objective-c: diagnose protocol inconsistencies in following Fariborz Jahanian2011-08-041-1/+126
| | | | | | | | situation. When a class explicitly or implicitly (through inheritance) "conformsTo" two protocols which conflict (have methods which conflict). This is 2nd part of // rdar://6191214. llvm-svn: 136927
* Refactoring of my last patch.Fariborz Jahanian2011-08-031-40/+33
| | | | llvm-svn: 136841
* objective-c: Methods declared in methods must type matchFariborz Jahanian2011-08-031-86/+101
| | | | | | those declated in its protocols. First half or // rdar://6191214 llvm-svn: 136794
* objective-c: warn if implementation of a method in categoryFariborz Jahanian2011-07-281-34/+142
| | | | | | | | | | masks an existing method in its primary class, class extensions, and primary class's non-optional protocol methods; as primary class, or one of its subclass's will implement this method. This warning has potential of being noisy so it has its own group. // rdar://7020493 llvm-svn: 136426
* Make Sema::ReferencedSelectors lazily deserialized.Douglas Gregor2011-07-281-0/+8
| | | | llvm-svn: 136357
* objc: clang should warn if redeclaration of methodsFariborz Jahanian2011-07-241-9/+113
| | | | | | | | | declared in protocol in the class qualified by the protocol have type conflicts. To reduce amount of noise, this is done when class is implemented. // rdar://9352731 llvm-svn: 135890
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-8/+8
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Move this ObjCImplementationDecl member function into libASTJohn McCall2011-07-221-13/+0
| | | | | | where it belongs. llvm-svn: 135746
* In Objective-C, pull arbitrary attributes from overriddenJohn McCall2011-07-221-158/+159
| | | | | | | | | | | | | | | methods, including indirectly overridden methods like those declared in protocols and categories. There are mismatches that we would like to diagnose but aren't yet, but this is fine for now. I looked at approaches that avoided doing this lookup unless we needed it, but the infer-related-result-type checks were doing it anyway, so I left it with the same fast-path check for no previous declartions of that selector. llvm-svn: 135743
* Add a const overload for ObjCInterfaceDecl::all_declared_ivar_begin.Jordy Rose2011-07-221-2/+2
| | | | | | | | | This was previously not-const only because it has to lazily construct a chain of ivars the first time it is called (and after the chain is invalidated). In practice, all the clients were just const_casting their const Decls; all those now-unnecessary const_casts have been removed. llvm-svn: 135741
* Add FixIt hint for missing 'id' type.Fariborz Jahanian2011-07-211-1/+2
| | | | | | // rdar://9615045 llvm-svn: 135685
* objc - Diagnose missing method return type specifier underFariborz Jahanian2011-07-211-1/+3
| | | | | | a warning flag. // rdar://9615045 llvm-svn: 135681
* Fix a typo.Fariborz Jahanian2011-07-161-1/+1
| | | | llvm-svn: 135328
* Centralize the getCanonicalType() calls in the Itanium C++ manglingDouglas Gregor2011-07-121-2/+2
| | | | | | code so that they only occur in a single place. No functionality change. llvm-svn: 134961
* objc-arc: enforce performSelector rules in rejecting retaining selectorsFariborz Jahanian2011-07-051-0/+8
| | | | | | | passed to it, and unknown selectors causing potential leak. // rdar://9659270 llvm-svn: 134449
* Add support for C++ namespace-aware typo correction, e.g., correctingDouglas Gregor2011-06-281-16/+17
| | | | | | | | | | | | | | | vector<int> to std::vector<int> Patch by Kaelyn Uhrain, with minor tweaks + PCH support from me. Fixes PR5776/<rdar://problem/8652971>. Thanks Kaelyn! llvm-svn: 134007
* Centralize the check for a tag definition in a Declarator::PrototypeContext ↵Argyrios Kyrtzidis2011-06-281-8/+1
| | | | | | | | inside GetTypeForDeclarator. No functionality change. llvm-svn: 133985
* No need to warn if 'unavailable' method/property Fariborz Jahanian2011-06-241-0/+3
| | | | | | is not implemented. // rdar://9651605 llvm-svn: 133819
* When forming a cycle in objc's inheritance hierarchy,Fariborz Jahanian2011-06-231-2/+5
| | | | | | | diagnose it properly and don't throw clang into an infinit loop. // rdar://9653341 llvm-svn: 133773
* Weaken the type-matching rules for methods that return aggregates whenJohn McCall2011-06-161-2/+37
| | | | | | complaining about mismatches in the global method pool. llvm-svn: 133123
* Automatic Reference Counting.John McCall2011-06-151-63/+366
| | | | | | | | | | Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
* Introduce a -cc1-level option to turn off related result typeDouglas Gregor2011-06-141-1/+2
| | | | | | inference, to be used (only) by the Objective-C rewriter. llvm-svn: 133025
* Eliminate the -f[no]objc-infer-related-result-type flags; there's noDouglas Gregor2011-06-131-2/+1
| | | | | | reason to allow the user to control these semantics through a flag. llvm-svn: 132919
* Document CheckObjCMethodOverridesDouglas Gregor2011-06-131-1/+9
| | | | llvm-svn: 132917
* Implement Objective-C Related Result Type semantics.Douglas Gregor2011-06-111-6/+262
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Related result types apply Cocoa conventions to the type of message sends and property accesses to Objective-C methods that are known to always return objects whose type is the same as the type of the receiving class (or a subclass thereof), such as +alloc and -init. This tightens up static type safety for Objective-C, so that we now diagnose mistakes like this: t.m:4:10: warning: incompatible pointer types initializing 'NSSet *' with an expression of type 'NSArray *' [-Wincompatible-pointer-types] NSSet *array = [[NSArray alloc] init]; ^ ~~~~~~~~~~~~~~~~~~~~~~ /System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:72:1: note: instance method 'init' is assumed to return an instance of its receiver type ('NSArray *') - (id)init; ^ It also means that we get decent type inference when writing code in Objective-C++0x: auto array = [[NSMutableArray alloc] initWithObjects:@"one", @"two",nil]; // ^ now infers NSMutableArray* rather than id llvm-svn: 132868
* refactor CheckForwardProtocolDeclarationForCircularDependency returnsFariborz Jahanian2011-05-131-8/+11
| | | | | | 'true' on detecting protocol cycles. No functionality change. llvm-svn: 131297
OpenPOWER on IntegriCloud