summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* ARC: make assignment to 'self' within class methods illegal. Fixes ↵Ted Kremenek2011-11-141-11/+20
| | | | | | <rdar://problem/10416568>. llvm-svn: 144572
* [PCH] When completing an objc forward reference, do not serialize the chain ↵Argyrios Kyrtzidis2011-11-121-0/+14
| | | | | | | | | | | | | | | of its categories because it is going to be rewritten (and the chain will be serialized again), otherwise we may form a cycle in its categories list when deserializing. Also introduce ASTMutationListener::CompletedObjCForwardRef to notify that a forward reference was completed; using Decl's isChangedSinceDeserialization/setChangedSinceDeserialization is bug inducing and kinda gross, we should phase it out. Fixes infinite loop in rdar://10418538. llvm-svn: 144465
* Relax restriction of assigning to 'self' in ARC when a method is attributed ↵Ted Kremenek2011-10-251-2/+2
| | | | | | with ns_consumes_self. Fixes <rdar://problem/10274056>. llvm-svn: 142909
* Don't forget to complete the objc interface before asking for information,Argyrios Kyrtzidis2011-10-191-0/+9
| | | | | | otherwise lldb will suffer. llvm-svn: 142471
* Have ObjCMethodDecl::getCanonicalDecl take into account redeclared methods.Argyrios Kyrtzidis2011-10-171-0/+4
| | | | llvm-svn: 142231
* Keep track when a ObjC interface/protocol was initially created as a forward ↵Argyrios Kyrtzidis2011-10-171-4/+6
| | | | | | reference. llvm-svn: 142230
* [PCH] Serialize info about redeclared objc methods.Argyrios Kyrtzidis2011-10-141-2/+4
| | | | llvm-svn: 141964
* Really protect from infinite loop when there are objc method redeclarations.Argyrios Kyrtzidis2011-10-141-0/+12
| | | | | | Serialization part will come later. llvm-svn: 141950
* Keep track of objc method redeclarations in the same interface.Argyrios Kyrtzidis2011-10-141-1/+5
| | | | | | Avoid possible infinite loop when iterating over an ObjCMethod's redeclarations. llvm-svn: 141946
* Improve location fidelity of objc decls.Argyrios Kyrtzidis2011-10-041-12/+17
| | | | | | | | -Add the location of the class name to all objc container decls, not just ObjCInterfaceDecl. -Make objc decls consistent with the rest of the NamedDecls and have getLocation() point to the class name, not the location of '@'. llvm-svn: 141061
* Allow getting all source locations of selector identifiers in a ObjCMethodDecl.Argyrios Kyrtzidis2011-10-031-1/+36
| | | | | | | | | | | | | Instead of always storing all source locations for the selector identifiers we check whether all the identifiers are in a "standard" position; "standard" position is -Immediately before the arguments: -(id)first:(int)x second:(int)y; -With a space between the arguments: -(id)first: (int)x second: (int)y; -For nullary selectors, immediately before ';': -(void)release; In such cases we infer the locations instead of storing them. llvm-svn: 140989
* Pass from the parser the locations of selector identifiers when creatingArgyrios Kyrtzidis2011-10-031-0/+1
| | | | | | | | objc method decls. They are not stored in the AST yet. llvm-svn: 140984
* Don't keep NumSelectorArgs in the ObjCMethodDecl, the number can be derived ↵Argyrios Kyrtzidis2011-10-031-4/+2
| | | | | | from the selector. llvm-svn: 140983
* Removing a bunch of dead returns/breaks after llvm_unreachables.David Blaikie2011-09-231-2/+0
| | | | llvm-svn: 140407
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-2/+2
| | | | llvm-svn: 140367
* Support importing of ObjC categories from modules.Argyrios Kyrtzidis2011-09-011-1/+3
| | | | | | | | | | | | The initial incentive was to fix a crash when PCH chaining categories to an interface, but the fix was done in the "modules way" that I hear is popular with the kids these days. Each module stores the local chain of categories and we combine them when the interface is loaded. We also warn if non-dependent modules introduce duplicate named categories. llvm-svn: 138926
* Remove a few mutating ObjCCategoryDecl methods.Argyrios Kyrtzidis2011-08-301-2/+18
| | | | | | | | | | | Remove -setClassInterface -setNextClassCategory -insertNextClassCategory and combine them in the Create function. llvm-svn: 138817
* Warn on missing [super finalize] calls.Nico Weber2011-08-281-0/+1
| | | | | | This matches gcc's logic. Second half of PR10661. llvm-svn: 138730
* objective-c: Treat top-level objective-c declarationsFariborz Jahanian2011-08-271-20/+15
| | | | | | | | | | , 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
* Fix else style. No functionality change intended.Chad Rosier2011-08-171-2/+1
| | | | llvm-svn: 137896
* Mark objc methods that are implicitly declared for properties (not ↵Argyrios Kyrtzidis2011-08-171-1/+3
| | | | | | | | user-declared) as implicit. This results in libclang ignoring such methods. llvm-svn: 137852
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-3/+3
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Move this ObjCImplementationDecl member function into libASTJohn McCall2011-07-221-0/+13
| | | | | | where it belongs. llvm-svn: 135746
* objc-arc: enforce performSelector rules in rejecting retaining selectorsFariborz Jahanian2011-07-051-0/+28
| | | | | | | passed to it, and unknown selectors causing potential leak. // rdar://9659270 llvm-svn: 134449
* Objective-C fast enumeration loop variables are not retained in ARC, butJohn McCall2011-06-171-3/+9
| | | | | | | | | | | | they should still be officially __strong for the purposes of errors, block capture, etc. Make a new bit on variables, isARCPseudoStrong(), and set this for 'self' and these enumeration-loop variables. Change the code that was looking for the old patterns to look for this bit, and change IR generation to find this bit and treat the resulting variable as __unsafe_unretained for the purposes of init/destroy in the two places it can come up. llvm-svn: 133243
* Automatic Reference Counting.John McCall2011-06-151-2/+22
| | | | | | | | | | 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
* Implement Objective-C Related Result Type semantics.Douglas Gregor2011-06-111-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fixed source range for all DeclaratorDecl's.Abramo Bagnara2011-03-081-4/+7
| | | | llvm-svn: 127225
* Work around a misdesigned GCC warning.John McCall2011-03-021-1/+1
| | | | llvm-svn: 126879
* Provide an attribute, objc_method_family, to allow the inferred familyJohn McCall2011-03-021-0/+16
| | | | | | | | | | of an Objective-C method to be overridden on a case-by-case basis. This is a higher-level tool than ns_returns_retained &c.; it lets users specify that not only does a method have different retain/release semantics, but that it semantically acts differently than one might assume from its name. This in turn is quite useful to static analysis. llvm-svn: 126839
* Move some of the logic about classifying Objective-C methods intoJohn McCall2011-03-021-0/+42
| | | | | | | | conventional categories into Basic and AST. Update the self-init checker to use this logic; CFRefCountChecker is complicated enough that I didn't want to touch it. llvm-svn: 126817
* Diagnose when accessing property in a class method andFariborz Jahanian2010-12-031-4/+6
| | | | | | | no property accessor class method to be found, instead of crashing in IRGen. // rdar://8703553 llvm-svn: 120855
* Extend ExternalASTSource with the ability to lazily complete theDouglas Gregor2010-12-011-1/+31
| | | | | | | | | | | | | definition of an Objective-C class. Unlike with C/C++ classes, we don't have a well-defined point in Sema where Objective-C classes are checked for completeness, nor do we need to involve Sema when completing a class. Therefore, we take the appropriate of having the external AST source mark a particular Objective-C class as having an external declaration; when using one of the accessors of an Objective-C class that has an external declaration, we request that the external AST source fill in the Objective-C class definition. llvm-svn: 120627
* For an Objective-C @synthesize statement, e.g.,Douglas Gregor2010-11-171-3/+10
| | | | | | | | | @synthesize foo = _foo; keep track of the location of the ivar ("_foo"). Teach libclang to visit the ivar as a member reference. llvm-svn: 119447
* Rename alignof -> alignOf to avoid irritating C++'0x compilers,Chris Lattner2010-10-301-1/+1
| | | | | | PR8423 llvm-svn: 117775
* Split ObjCInterfaceDecl::ReferencedProtocols into two lists: ↵Ted Kremenek2010-09-011-20/+20
| | | | | | | | | | | | | ReferencedProtocols and AllReferencedProtocols. ReferencedProtocols (and thus protocol_begin(), protocol_end()) now only contains the list of protocols that were directly referenced in an @interface declaration. 'all_referenced_protocol_[begin,end]()' now returns the set of protocols that were referenced in both the @interface and class extensions. The latter is needed for semantic analysis/codegen, while the former is needed to maintain the lexical information of the original source. Fixes <rdar://problem/8380046>. llvm-svn: 112691
* Support for IRGen of synthesize bitfield ivars inFariborz Jahanian2010-08-231-3/+10
| | | | | | objc-nonfragile-abi2 (radar 7824380). llvm-svn: 111823
* objective-c ivar refactoring patch. IterationsFariborz Jahanian2010-08-201-1/+55
| | | | | | | | over ivars for a varienty of puposes is now consolidated into two small routines; DeepCollectObjCIvars and ShallowCollectObjCIvars. llvm-svn: 111679
* Speculatively revert r110610 " Make ObjCInterfaceDecl redeclarable,Douglas Gregor2010-08-111-23/+3
| | | | | | | | and create separate decl nodes for forward declarations and the definition," which appears to be causing significant Objective-C breakage. llvm-svn: 110803
* - Make ObjCInterfaceDecl redeclarable, and create separate decl nodes for ↵Sebastian Redl2010-08-091-3/+23
| | | | | | | | | | forward declarations and the definition. - Eagerly create ObjCInterfaceTypes for declarations. - The two above changes lead to a 0.5% increase in memory use and no speed regression when parsing Cocoa.h. On the other hand, now chained PCH works when there's a forward declaration in one PCH and the interface definition in another. - Add HandleInterestingDecl to ASTConsumer. PCHReader passes the "interesting" decls it finds to this function instead of HandleTopLevelDecl. The default implementation forwards to HandleTopLevelDecl, but ASTUnit's handler for example ignores them. This fixes a potential crash when lazy loading of PCH data would cause ASTUnit's "top level" declaration collection to change while being iterated. llvm-svn: 110610
* Remove the vast majority of the Destroy methods from the AST library,Douglas Gregor2010-07-251-70/+1
| | | | | | since we aren't going to be calling them ever. llvm-svn: 109377
* atch for implementation of objective-c's -WselectorFariborz Jahanian2010-07-221-1/+3
| | | | | | | warning flag in clang. Little more to do for a PCH issue. Radar 6507158. llvm-svn: 109129
* Patch to synthesize property ivars on demand asFariborz Jahanian2010-07-171-2/+3
| | | | | | | part of the new property synthesis by default. wip. llvm-svn: 108599
* Patch to provide separate ASTs for multiple ObjC class extension Fariborz Jahanian2010-06-221-6/+15
| | | | | | declarations (implements radar 7928731). llvm-svn: 106597
* Remember type source information for Objective C property declarations.John McCall2010-06-041-1/+1
| | | | llvm-svn: 105484
* Add raw_ostream operators to NamedDecl for convenience. Switch over all ↵Benjamin Kramer2010-04-171-0/+12
| | | | | | | | users of getNameAsString on a stream. The next step is to print the name directly into the stream, avoiding a temporary std::string copy. llvm-svn: 101632
* Implement method type encoding in the presenseFariborz Jahanian2010-04-081-2/+4
| | | | | | of c-style arguments. Completes radar 7445205. llvm-svn: 100813
* AST: Add ObjCIvarDecl::getContainingInterface().Daniel Dunbar2010-04-021-0/+23
| | | | llvm-svn: 100227
* Sema/Obj-C: Narrow type of ObjCIvarDecl::Create, and check additional ↵Daniel Dunbar2010-04-021-1/+17
| | | | | | | | invariants on the provided DeclContext. - Doug, please see the FIXME in DeclObjC.cpp -- I am not sure what the right fix is. llvm-svn: 100213
* Make the CIndex API more resilient to being used on invalid code.Ted Kremenek2010-03-191-1/+4
| | | | llvm-svn: 98981
OpenPOWER on IntegriCloud